:root {
  color-scheme: light dark;

  --surface:     #f6f7f8;
  --surface-low: #eceef0;
  --fg:          #14161a;
  --fg-2:        #464b53;
  --fg-3:        #757b84;
  --hairline:    rgb(20 22 26 / .12);
  --yellow:      #ffcc00;
  --link-line:   rgb(20 22 26 / .3);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 46rem;
  --pad: clamp(1.25rem, .5rem + 3vw, 2.5rem);
}
@media (prefers-color-scheme: dark) {
  :root:not(.t-light) {
    --surface:     #121416;
    --surface-low: #1b1e21;
    --fg:          #eceef0;
    --fg-2:        #a9afb7;
    --fg-3:        #7a818a;
    --hairline:    rgb(236 238 240 / .13);
    --link-line:   rgb(236 238 240 / .35);
  }
}
:root.t-dark {
  color-scheme: dark;
  --surface:     #121416;
  --surface-low: #1b1e21;
  --fg:          #eceef0;
  --fg-2:        #a9afb7;
  --fg-3:        #7a818a;
  --hairline:    rgb(236 238 240 / .13);
  --link-line:   rgb(236 238 240 / .35);
}
:root.t-light { color-scheme: light; }

* { box-sizing: border-box; }
body, h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
dialog { border: 0; padding: 0; max-width: none; max-height: none; color: inherit; background: none; }
dialog:not([open]) { display: none !important; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--surface);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--yellow); color: #14161a; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 2px; }

a { color: inherit; text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--yellow); text-decoration-thickness: 2px; }
code { font-size: .92em; }

.shell { max-width: calc(var(--measure) + 2 * var(--pad)); margin-inline: auto; padding-inline: var(--pad); }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--fg); color: var(--surface); padding: .5rem .8rem; z-index: 10; }

/* top line */
.top { display: flex; align-items: center; gap: 1.5rem; padding-block: 1.25rem; }
.brand { font-weight: 600; text-decoration: none; margin-inline-end: auto; }
.top nav { display: flex; gap: 1.25rem; font-size: .95rem; }
.top nav a { text-decoration: none; color: var(--fg-2); }
.top nav a:hover { color: var(--fg); }
.theme { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .375rem; color: var(--fg-2); }
.theme:hover { color: var(--fg); background: var(--surface-low); }
.theme svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ico-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not(.t-light) .ico-dark { display: block; }
  :root:not(.t-light) .ico-light { display: none; }
}
:root.t-dark .ico-dark { display: block; }
:root.t-dark .ico-light { display: none; }
@media (width < 30rem) { .top nav { display: none; } }

/* intro */
.intro { padding-block: clamp(2.5rem, 1rem + 5vw, 4.5rem) clamp(2rem, 1rem + 3vw, 3rem); }
.hero { display: grid; gap: 2rem; align-items: center; }
@media (width >= 44rem) { .hero { grid-template-columns: minmax(0, 1fr) 13rem; gap: 3rem; } }
.portrait { width: 13rem; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 18%; border-radius: .75rem; box-shadow: 0 10px 30px -12px rgb(0 0 0 / .35); }
@media (width < 44rem) { .portrait { width: 9rem; order: -1; } }
h1 { font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3rem); font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.title { margin-block: .6rem 1.25rem; font-size: 1.05rem; font-weight: 600; color: var(--fg-2); }
.summary { font-size: 1.075rem; line-height: 1.65; color: var(--fg); max-width: 38rem; }
.summary + .summary { margin-block-start: .75rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-block-start: 1.6rem; }
.btn { display: inline-flex; align-items: center; padding: .6rem 1.1rem; border-radius: .375rem; border: 1px solid var(--hairline-2, var(--link-line)); font-size: .95rem; font-weight: 600; text-decoration: none; color: var(--fg); transition: border-color .15s ease, background .15s ease; }
.btn:hover { border-color: var(--fg); text-decoration: none; }
.btn-primary { background: var(--fg); border-color: var(--fg); color: var(--surface); }
.btn-primary:hover { background: var(--yellow); border-color: var(--yellow); color: #14161a; }
.location { margin-inline-start: .5rem; color: var(--fg-3); font-size: .95rem; }

.competencies-title { margin-block-start: clamp(2.5rem, 1.5rem + 3vw, 3.5rem); }
.competencies { display: grid; gap: 0 2.5rem; }
@media (width >= 40rem) { .competencies { grid-template-columns: 1fr 1fr; } }
.competencies div { padding-block: .9rem; border-block-start: 1px solid var(--hairline); }
@media (width >= 40rem) { .competencies div:nth-child(-n+2) { border-block-start: 0; padding-block-start: 0; } }
@media (width < 40rem) { .competencies div:first-child { border-block-start: 0; padding-block-start: 0; } }
.competencies dt { font-weight: 700; }
.competencies dd { color: var(--fg-2); font-size: .95rem; margin-block-start: .2rem; }

.links { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin-block-start: 1.75rem; }
.links button { text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: .2em; }
.links button:hover { text-decoration-color: var(--yellow); }

/* sections */
main > section + section { border-block-start: 1px solid var(--hairline); }
main > section:not(.intro) { padding-block: clamp(2.5rem, 1.5rem + 3vw, 3.75rem); }
h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: 0; margin-block-end: 1.25rem; padding-block-end: .5rem; border-block-end: 1px solid var(--hairline); }
h3 { font-size: 1.0625rem; font-weight: 700; line-height: 1.4; }

/* selected work */
.work { display: grid; gap: 1rem 1.5rem; padding-block: 1.5rem; border-block-start: 1px solid var(--hairline); }
.work:first-of-type { border-block-start: 0; padding-block-start: 0; }
@media (width >= 40rem) { .work { grid-template-columns: 9.5rem minmax(0, 1fr); } }
.work-photo { display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border-radius: .5rem; background: var(--surface-low); text-decoration: none; }
.work-photo img { width: 100%; height: 100%; object-fit: cover; }
/* wide app screenshots are shown whole, not cropped */
.work-photo img.fit { object-fit: contain; background: #111315; }
.work-photo--none { visibility: hidden; }
@media (width < 40rem) { .work-photo--none { display: none; } .work-photo { max-width: 14rem; } }
.work-photo--text { display: grid; place-items: center; height: 100%; font-weight: 600; color: var(--fg-2); }
.meta { color: var(--fg-3); font-size: .9rem; margin-block: .25rem .7rem; }
.work p:not(.meta):not(.work-links) { color: var(--fg-2); }
.work p:not(.meta) + p { margin-block-start: .7rem; }
.work-links { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-block-start: .75rem; font-size: .95rem; }
.work-links span { color: var(--fg-3); }
.work-links button { text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: .2em; }
.work-links button:hover { text-decoration-color: var(--yellow); }

.sub { margin-block: 2.25rem .75rem; }
.others li { padding-block: .55rem; border-block-start: 1px solid var(--hairline); color: var(--fg-2); }
.others li:last-child { border-block-end: 1px solid var(--hairline); }
.others a, .others-name, .others-plain { color: var(--fg); font-weight: 600; margin-inline-end: .35rem; }
.others-name { text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: .2em; }
.others-name:hover { text-decoration-color: var(--yellow); text-decoration-thickness: 2px; }
.others span:not(.others-plain) { color: var(--fg-3); font-size: .88rem; margin-inline-start: .35rem; }

/* click-to-load video: nothing is fetched from YouTube until it is played */
.video { margin-block: 1rem .25rem; aspect-ratio: 16 / 9; border-radius: .5rem; overflow: hidden; background: #000; }
.video button { position: relative; display: block; width: 100%; height: 100%; }
.video img { width: 100%; height: 100%; object-fit: cover; opacity: .75; }
.video span { position: absolute; left: 1rem; bottom: 1rem; padding: .5rem .8rem; border-radius: .375rem; background: #fff; color: #14161a; font-weight: 600; font-size: .95rem; }
.video button:hover span { background: var(--yellow); }
.video iframe { width: 100%; height: 100%; border: 0; display: block; }

/* experience / education */
.rows li { display: grid; gap: .2rem 1.5rem; padding-block: 1rem; border-block-start: 1px solid var(--hairline); }
.rows li:first-child { border-block-start: 0; padding-block-start: 0; }
@media (width >= 40rem) { .rows li { grid-template-columns: 9.5rem minmax(0, 1fr); } }
.role-line { color: var(--fg) !important; margin-block-start: .6rem !important; }
.role-line b { font-weight: 600; }
.certs li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .1rem 1rem; padding-block: .6rem; border-block-start: 1px solid var(--hairline); }
.certs li:first-child { border-block-start: 0; padding-block-start: 0; }
.certs li span:last-child { color: var(--fg-3); }
.when { color: var(--fg-3); font-variant-numeric: tabular-nums; }
.rows p:not(.when) { color: var(--fg-2); margin-block-start: .2rem; }

/* tools */
.tools div { display: grid; gap: .1rem 1.5rem; padding-block: .6rem; border-block-start: 1px solid var(--hairline); }
.tools div:first-child { border-block-start: 0; padding-block-start: 0; }
@media (width >= 40rem) { .tools div { grid-template-columns: 15rem minmax(0, 1fr); } }
.tools dt { font-weight: 600; }
.tools dd { color: var(--fg-2); }

#contact > p:first-of-type { color: var(--fg-2); }

.foot { padding-block: 2rem 2.5rem; color: var(--fg-3); font-size: .9rem; border-block-start: 1px solid var(--hairline); }

/* photo viewer */
#viewer {
  width: min(64rem, 100vw);
  height: min(100dvh, 48rem);
  margin: auto;
  background: var(--surface);
  border-radius: .75rem;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
#viewer::backdrop { background: rgb(0 0 0 / .7); }
.viewer-top, .viewer-nav { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; color: var(--fg-2); font-size: .95rem; }
.viewer-top button, .viewer-nav button { padding: .35rem .7rem; border-radius: .375rem; border: 1px solid var(--hairline); }
.viewer-top button:hover, .viewer-nav button:hover { border-color: var(--fg-3); }
.viewer-stage { display: grid; place-items: center; min-height: 0; background: var(--surface-low); }
.viewer-stage img, .viewer-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }

@media print {
  .top nav, .theme, #viewer, .work-photo, .work-links button, #copyMail { display: none !important; }
  body { background: #fff; color: #000; }
}
