/* dark theme overrides for the base template; light keeps the original look */
.theme-toggle {
	position: absolute; right: 1em; top: 50%; transform: translateY(-50%);
	width: 2.3em; height: 2.3em; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
	background: transparent !important; box-shadow: none !important; color: #fff; font-size: 1em; line-height: 1;
	display: grid; place-items: center;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.1) !important; }
.theme-toggle svg { pointer-events: none; display: block; }

html[data-theme="dark"] body { background: #0e1319; }
html[data-theme="dark"] body, html[data-theme="dark"] input, html[data-theme="dark"] textarea { color: #9aa6b5; }
html[data-theme="dark"] h1, html[data-theme="dark"] h2, html[data-theme="dark"] h3,
html[data-theme="dark"] h4, html[data-theme="dark"] h5, html[data-theme="dark"] h6 { color: #e6edf5; }
html[data-theme="dark"] strong, html[data-theme="dark"] b { color: #e6edf5; }
html[data-theme="dark"] .wrapper { background-image: none; box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.04); text-shadow: none; }
html[data-theme="dark"] .wrapper.style1 { background-color: #0e1319; }
html[data-theme="dark"] .wrapper.style2 { background-color: #121921; }
html[data-theme="dark"] .wrapper.style3 { background-color: #0f151c; }
html[data-theme="dark"] .wrapper.style4 { background-color: #0a0e13; }
html[data-theme="dark"] .box { background: #18212b; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), 0 2px 6px 0 rgba(0, 0, 0, 0.4); }
html[data-theme="dark"] #nav { background-color: #0a0e13; }
html[data-theme="dark"] .icon.featured { color: #cfd9e6 !important; }
html[data-theme="dark"] form input[type=text], html[data-theme="dark"] form textarea { background: #151d26 !important; }
html[data-theme="dark"] hr { border-top-color: rgba(255, 255, 255, 0.12); }
/* the template nudges pressed buttons with top: 1px; that would yank this one out from under the cursor and swallow the click */
.theme-toggle, .theme-toggle:hover, .theme-toggle:active { top: 50% !important; transform: translateY(-50%) !important; background-color: transparent !important; }
.theme-toggle:hover { background-color: rgba(255, 255, 255, 0.1) !important; }

/* theme switch: crossfade via view transitions, color tween as the fallback */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .45s; animation-timing-function: ease-in-out; }
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
	transition: background-color .4s ease, color .4s ease, border-color .4s ease, box-shadow .4s ease, fill .4s ease, stroke .4s ease !important;
}

/* tech stack marks: monochrome masks so every logo shares the card's tone, brand color on hover */
.box.style1.equal-height { display: flex; flex-direction: column; height: 100%; }
.box.style1.equal-height > p { margin-bottom: 1.6em; }
.tech-row {
	list-style: none; margin: auto 0 0; padding: 1.3em 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .55em 1.05em;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
}
html[data-theme="dark"] .tech-row { border-top-color: rgba(255, 255, 255, 0.08); }
.tech-row li { padding: 0; margin: 0; }
.tech {
	--idle: #9aa3ae; --fill: var(--c, #3e3e3e);
	position: relative; display: block; width: 1.55em; height: 1.55em;
	-webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat;
	/* a two-tone gradient taller than the icon; sliding it up fills the mark with brand color from the bottom.
	   the extra 20% keeps the color edge out of view at rest, where subpixel rounding let a sliver peek through */
	background: linear-gradient(to top, var(--fill) 50%, var(--idle) 50%) 0 0 / 100% 220% no-repeat;
	transition: background-position .45s cubic-bezier(.4, 0, .2, 1);
}
html[data-theme="dark"] .tech { --idle: #7f8b9b; --fill: var(--c, #e6edf5); }
.tech-row li:hover .tech { background-position: 0 100%; }
/* the mask clips pseudo-elements, so the label lives on the list item instead */
/* the lift lives on the li, pre-promoted to its own layer: animating a transform on the
   masked span made the browser re-rasterize the mask mid-hover and blank it for a frame */
.tech-row li { position: relative; will-change: transform; transition: transform .2s ease; }
.tech-row li:hover { transform: translateY(-2px); }
.tech-row li::after {
	content: attr(data-label); position: absolute; left: 50%; bottom: calc(100% + .45em); transform: translate(-50%, 4px);
	white-space: nowrap; font-size: .62em; font-weight: 600; line-height: 1.6; padding: .1em .55em; border-radius: 4px;
	background: #1f2937; color: #fff; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; text-shadow: none;
}
.tech-row li:hover::after { opacity: 1; transform: translate(-50%, 0); }
/* project cards stretch to the shared height set by equalize.js */
#portfolio .box.style2 { box-sizing: border-box; }

/* multi-color marks (python, bedrock, weaviate) reveal their real artwork with the same rising fill;
   the mono layer underneath fills with transparent so only the artwork shows */
.tech-full {
	position: absolute; left: 0; top: 0; width: 1.55em; height: 1.55em; pointer-events: none;
	background: var(--f) center / contain no-repeat; clip-path: inset(100% 0 0 0);
	transition: clip-path .45s cubic-bezier(.4, 0, .2, 1);
}
.tech-row li:hover .tech-full { clip-path: inset(0 0 0 0); }
/* marks with a light-on-dark variant (jwt's white bars) swap artwork with the theme */
html[data-theme="dark"] .tech-full { background-image: var(--fd, var(--f)); }
/* project cards: logo row pinned to the bottom of the equal-height card */
#portfolio .box.style2 { display: flex; flex-direction: column; }
#portfolio .box.style2 > p { margin-bottom: 1.6em; }
#portfolio .box.style2 .tech-row { margin-top: auto; }

/* paired flow buttons in the portfolio footer: side by side on wide screens, stacked like the other large buttons on phones */
.cta-pair { margin: 0; }
.cta-pair li { vertical-align: middle; }

/* five links plus the toggle overrun a phone's width, so links tighten and the row clears the toggle */
@media screen and (max-width: 736px) {
	#nav ul { padding-right: 2.4em; box-sizing: border-box; }
	#nav a { padding: 0 0.5em; }
	.theme-toggle { right: 0.4em; }
}

/* free-time carousel: native scroll-snap keeps swipe, trackpad and keyboard scrolling for free,
   the buttons only nudge it one card at a time */
.carousel-head { display: flex; align-items: center; justify-content: space-between; gap: 1em; }
.carousel-head h3 { flex: 1; }
.carousel-nav { display: flex; gap: .5em; margin: 0 0 1em; }
.carousel-btn { padding: 0; width: 2.2em; height: 2.2em; font-size: 1.2em; line-height: 2.2em; text-align: center; }
.carousel-btn:disabled { opacity: .35; cursor: default; }
.carousel-track {
	--gap: 2.5em;
	display: flex; gap: var(--gap); overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
	/* the padding keeps the cards' shadows and the overhanging image frames inside the scroll box, which would clip them */
	padding: .5em .5em 1em; margin: -.5em -.5em 0; scroll-padding-inline: .5em; scrollbar-width: none; overscroll-behavior-x: contain;
}
/* the track must be the positioning context: absolutely positioned descendants (the screen-reader
   labels on source links) otherwise anchor to the body, escape the scroll clip and widen the page on phones */
.carousel-track { position: relative; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track:focus-visible { outline: 2px solid #43B3E0; outline-offset: 2px; }
.carousel-slide { flex: 0 0 calc((100% - 2 * var(--gap)) / 3); scroll-snap-align: start; display: flex; }
.carousel-slide > .box { flex: 1; margin: 0 !important; max-width: none !important; }
/* a peek of the next card on smaller screens tells visitors there is more to swipe */
@media screen and (max-width: 980px) { .carousel-slide { flex-basis: calc((100% - var(--gap)) / 2.15); } }
@media screen and (max-width: 736px) { .carousel-track { --gap: 1.25em; } .carousel-slide { flex-basis: 86%; } }
#portfolio .box.style2 > p.source-link { margin: -.9em 0 1.6em; text-align: left; font-size: .9em; }

/* card clips: poster first, video fades in over it once it is actually playing */
.card-media { position: relative; display: block; }
.card-media > a { display: block; position: relative; }
.card-media img { display: block; width: 100%; height: auto; }
.card-clip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s ease; pointer-events: none; }
.card-media.is-playing .card-clip { opacity: 1; }
.clip-toggle, .clip-toggle:hover, .clip-toggle:active {
	position: absolute; right: .6em; bottom: .6em; top: auto; z-index: 2;
	width: 2.2em; height: 2.2em; padding: 0; margin: 0; border-radius: 50%; display: grid; place-items: center;
	background: rgba(14, 19, 25, .72) !important; background-image: none !important; color: #fff !important;
	box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); font-size: 1em; line-height: 1; opacity: .8; transition: opacity .2s;
}
.clip-toggle:hover, .clip-toggle:focus-visible { opacity: 1; }
.clip-toggle:focus-visible { outline: 2px solid #43B3E0; outline-offset: 2px; }
/* screen-reader-only text, used to name repeated links like "view the source" per project */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* the template's #666 footer line fails contrast on the dark background */
html[data-theme="dark"] #copyright li { color: #8b97a7; }
/* width and height attributes reserve space against layout shift; height auto keeps the drawn ratio true */
.image img { height: auto; }
/* the animated name svg is drawn 370px wide, more than a 360px phone has room for */
#top header img { max-width: 100%; height: auto; }
/* the smallest phones (320-360px) still wrapped contact onto a second row */
@media screen and (max-width: 360px) {
	#nav a { padding: 0 0.32em; font-size: 0.92em; }
}
