/* ------------
   Fonts
------------- */

@font-face {
	font-family: 'ubuntu';
	src: url('font/Ubuntu-Regular.ttf') format('truetype');
	font-weight: normal;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: 'ubuntu';
	src: url('font/Ubuntu-Bold.ttf') format('truetype');
	font-weight: bold;
	font-style: normal;
	font-display: swap;
}

/* ------------
   Variables

   The colours (--bg, --card, --accent, ...) come from colors.css.
   Everything below is derived from them, so schemes never need to touch this file.
------------- */

:root {
	--shadow: color-mix(in srgb, var(--ink) 55%, var(--bg));
	--shadow-soft: color-mix(in srgb, var(--bg) 82%, var(--ink));
	--hover-tint: color-mix(in srgb, var(--bg) 82%, var(--accent));
	--float-shadow: rgba(0, 0, 0, 0.25);

	--radius-card: clamp(1.75rem, 3vw, 2.5rem);
	--card-pad: clamp(0.75rem, 1.6vw, 1rem);
	--nav-width: 10rem;

	/* Fluid type scale: 320px -> 1440px viewports */
	--step-text: clamp(1.05rem, 0.98rem + 0.25vw, 1.2rem);
	--step-nav: clamp(1.2rem, 1.1rem + 0.3vw, 1.4rem);
	--step-card-title: clamp(1.5rem, 1.3rem + 0.7vw, 1.9rem);
	--step-sub: clamp(1.6rem, 1.03rem + 3.3vw, 4rem);
	--step-brand: clamp(2.4rem, 1.86rem + 3.7vw, 5.2rem);
}

/* ------------
   Base
------------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	font-family: ubuntu, sans-serif;
	font-size: var(--step-text);
	line-height: 1.5;
	background: var(--bg);
	color: var(--ink);
	min-height: 100vh;
	overflow-wrap: break-word;
}

h1, h2, h3, p, ul, figure {
	margin: 0;
}

img {
	display: block;
	max-width: 100%;
	height: auto;
}

a {
	color: var(--ink);
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: 3px;
}

.skip-link {
	position: absolute;
	left: 1rem;
	top: -4rem;
	z-index: 100;
	padding: 0.6rem 1rem;
	border-radius: 1rem;
	background: var(--ink);
	color: var(--card);
	font-weight: bold;
	transition: top 0.2s;
}

.skip-link:focus {
	top: 1rem;
	text-decoration: none;
}

/* Icons are masks so they take on the text colour of whatever they sit in */
.icon {
	display: inline-block;
	flex: none;
	width: 1.3em;
	height: 1.3em;
	background-color: currentColor;
	-webkit-mask: var(--icon) center / contain no-repeat;
	mask: var(--icon) center / contain no-repeat;
}

.icon-github { --icon: url("github-mark-white.svg"); }
.icon-globe { --icon: url("globe.svg"); }

/* Short fade when the visitor switches theme */
.theme-transition,
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
	transition: background-color 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s !important;
}

/* ------------
   Page layout
------------- */

.page {
	display: grid;
	grid-template-columns: var(--nav-width) minmax(0, 1fr);
	grid-template-areas:
		"header header"
		"nav    main"
		"nav    footer";
	column-gap: clamp(1rem, 2.5vw, 2rem);
	max-width: 90rem;
	margin: 0 auto;
	padding: 0 clamp(1rem, 3vw, 2rem) 2rem;
}

/* ------------
   Header
------------- */

.site-header {
	grid-area: header;
	display: grid;
	grid-template-columns: 1fr auto;
	grid-template-areas:
		"brand tools"
		"sub   sub";
	align-items: start;
	column-gap: 1rem;
	padding: clamp(0.5rem, 2vw, 1.25rem) 0 clamp(1rem, 2vw, 1.5rem);
}

.big-heading {
	grid-area: brand;
	font-size: var(--step-brand);
	font-weight: bold;
	line-height: 1.1;
	color: var(--accent);
	margin: 0.15em 0 0.1em 0.1em;
}

.big-heading a,
.big-heading a:hover {
	color: inherit;
	text-decoration: none;
}

.big-subheading {
	grid-area: sub;
	position: relative;
	font-size: var(--step-sub);
	font-weight: bold;
	line-height: 1.15;
	color: var(--muted);
	margin: 0 0 0 0.15em;
}

/* The full text reserves the space, the typed text sits on top of it */
.typing-ghost {
	visibility: hidden;
}

.typing-live {
	position: absolute;
	inset: 0;
}

/* ------------
   Cat easter egg
------------- */

.cat-laser {
	position: fixed;
	top: -7px;
	left: -7px;
	z-index: 1000;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #ff2b2b;
	box-shadow: 0 0 6px 2px rgba(255, 43, 43, 0.65);
	pointer-events: none;
}

.cat-laser[hidden] {
	display: none;
}

.cat-laser.pop {
	animation: laser-pop 0.25s ease-out;
}

@keyframes laser-pop {
	from { scale: 2.2; opacity: 0.4; }
	to { scale: 1; opacity: 1; }
}

/* -------------
   Clock & theme switch
------------- */

.header-tools {
	grid-area: tools;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0.75rem;
}

.clock-container {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: clamp(1.4rem, 1rem + 1.8vw, 3rem);
	font-weight: bold;
	line-height: 1;
	color: var(--accent);
	padding-top: 0.35em;
}

.globe-icon {
	display: block;
	width: 0.9em;
	height: 0.9em;
	opacity: 0.7;
	flex: none;
	background-color: currentColor;
	-webkit-mask: url("globe.svg") center / contain no-repeat;
	mask: url("globe.svg") center / contain no-repeat;
}

.theme-switch {
	display: flex;
	gap: 0.15rem;
	padding: 0.2rem;
	border-radius: 999px;
	background: var(--card);
}

.theme-switch button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--ink);
	cursor: pointer;
}

.theme-switch button:hover {
	background: var(--hover-tint);
}

.theme-switch button[aria-pressed="true"] {
	background: var(--ink);
	color: var(--card);
}

.theme-switch svg {
	width: 1.15rem;
	height: 1.15rem;
}

/* ------------
   Navigation
------------- */

.site-nav {
	grid-area: nav;
	position: sticky;
	top: 1rem;
	align-self: start;
}

.nav-list {
	list-style: none;
	padding: 0;
}

.nav-list a {
	display: block;
	padding: 0.35rem 0.5rem;
	font-size: var(--step-nav);
	font-weight: bold;
	color: var(--ink);
}

.nav-list a:hover {
	color: var(--accent);
	font-style: italic;
}

.nav-list a[aria-current="page"] {
	color: var(--accent);
	font-style: italic;
}

.nav-list a[aria-current="page"]::after {
	content: " \2014";
}

.nav-toggle {
	display: none;
}

/* ------------
   Cards
------------- */

main {
	grid-area: main;
	min-width: 0;
}

.work {
	position: relative;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
	align-items: center;
	gap: clamp(1rem, 2.5vw, 1.75rem);
	margin-bottom: clamp(1.25rem, 3vw, 2.5rem);
	padding: var(--card-pad);
	background: var(--card);
	border-radius: var(--radius-card);
}

.work-media {
	min-width: 0;
	overflow: hidden;
	border-radius: calc(var(--radius-card) * 0.9);
	max-width: 37.5rem;
	width: 100%;
}

.work-media img {
	width: 100%;
}

.work-text {
	min-width: 0;
	padding: 0.25rem clamp(0.25rem, 1.5vw, 1.25rem) 0.75rem;
}

.work-text > * + * {
	margin-top: 0.85rem;
}

.card-title {
	font-size: var(--step-card-title);
	font-weight: bold;
	line-height: 1.2;
	color: var(--accent);
}

.card-subtitle {
	font-size: var(--step-card-title);
	font-weight: bold;
	line-height: 1.2;
	color: var(--accent-soft);
	margin-top: 0.15rem;
}

.work-text p {
	color: var(--text);
}

.work-text .card-subtitle {
	color: var(--accent-soft);
}

.work-text a {
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.work-text a:hover {
	color: var(--accent);
}

.feature-list {
	padding-left: 1.25rem;
	list-style: disc;
	color: var(--text);
}

.feature-list li + li {
	margin-top: 0.35rem;
}

.feature-list li::marker {
	color: var(--accent);
}

/* ------------
   Embeds & recommendations
------------- */

.work-embed {
	min-width: 0;
}

/* Works with the code Spotify gives you ("Share > Embed"), whatever size you pick */
.work-embed iframe {
	display: block;
	width: 100%;
	border: 0;
	border-radius: 12px;
	color-scheme: normal;
}

.work-wide {
	grid-template-columns: minmax(0, 1fr);
	align-items: start;
}

.rec-columns {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
	gap: 1.25rem clamp(1rem, 2.5vw, 1.75rem);
}

.rec-heading {
	font-size: calc(var(--step-text) * 1.1);
	font-weight: bold;
	color: var(--accent-soft);
	margin-bottom: 0.6rem;
}

.rec-list {
	list-style: none;
	padding: 0;
	display: grid;
	gap: 0.5rem;
}

.rec {
	padding: 0.65rem 1rem;
	border-radius: 15px;
	background: var(--bg);
	line-height: 1.35;
}

.rec-title {
	display: block;
	font-weight: bold;
	color: var(--ink);
}

.rec-meta {
	display: block;
	font-size: 0.9em;
	color: var(--muted);
}

.rec-note {
	display: block;
	margin-top: 0.25rem;
	font-size: 0.95em;
	color: var(--text);
}

/* ------------
   Buttons
------------- */

.btn,
button.btn {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	padding: 0.65rem 1.1rem;
	border: none;
	border-radius: 15px;
	font-family: ubuntu, sans-serif;
	font-size: var(--step-text);
	font-weight: bold;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	color: var(--card);
	background-color: var(--ink);
	box-shadow: 0 5px var(--shadow);
	margin-bottom: 5px;
	transition: filter 0.15s;
}

.work-text a.btn {
	color: var(--card);
	text-decoration: none;
}

.btn:hover,
.work-text a.btn:hover {
	color: var(--card);
	text-decoration: none;
	filter: brightness(1.15);
}

.btn:active {
	box-shadow: 0 1px var(--shadow);
	transform: translateY(4px);
}

.btn-secondary {
	background-color: var(--bg);
	color: var(--ink);
	box-shadow: 0 5px var(--shadow-soft);
}

.work-text a.btn-secondary,
.work-text a.btn-secondary:hover,
.btn-secondary:hover {
	color: var(--ink);
}

.btn-secondary:active {
	box-shadow: 0 1px var(--shadow-soft);
}

.btn-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1rem;
}

/* ------------
   Gallery carousel
------------- */

.carousel {
	aspect-ratio: 1 / 1;
	width: 100%;
	background: var(--bg);
}

.carousel .carousel-cell {
	width: 100%;
	height: 100%;
}

.carousel .carousel-cell img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	-webkit-user-drag: none;
}

/* Keep the dots inside the picture instead of overlapping the next element */
.carousel .flickity-page-dots {
	bottom: 0.75rem;
}

.carousel .flickity-page-dots .dot {
	background: #fff;
	opacity: 0.55;
	box-shadow: 0 0 4px rgba(0, 0, 0, 0.35);
}

.carousel .flickity-page-dots .dot.is-selected {
	opacity: 1;
}

.carousel .flickity-prev-next-button {
	width: 2.75rem;
	height: 2.75rem;
}

/* Before Flickity starts, only show the first picture */
.carousel:not(.flickity-enabled) {
	overflow: hidden;
	display: block;
}

.carousel:not(.flickity-enabled) .carousel-cell:not(:first-child) {
	display: none;
}

/* ------------
   Contact form
------------- */

.contact-form {
	color: var(--muted);
	padding: 0.25rem clamp(0.25rem, 1.5vw, 1.25rem) 0.75rem;
}

.contact-form .form-title {
	font-size: var(--step-card-title);
	font-weight: bold;
	line-height: 1.2;
	color: var(--accent);
	margin-bottom: 1rem;
}

.contact-form label {
	display: block;
	font-size: 1.15rem;
	font-weight: bold;
	margin-bottom: 1rem;
}

.contact-form input,
.contact-form textarea {
	display: block;
	width: 100%;
	max-width: 32rem;
	margin-top: 0.4rem;
	padding: 0.7rem 0.85rem;
	font-family: ubuntu, sans-serif;
	font-size: var(--step-text);
	font-weight: normal;
	color: var(--ink);
	background-color: var(--bg);
	border: 0;
	border-radius: 15px;
}

.contact-form textarea {
	max-width: 100%;
	height: 12.5em;
	resize: vertical;
}

.contact-form ::placeholder {
	color: var(--muted);
	opacity: 0.8;
}

.form-status {
	margin-top: 0.75rem;
	min-height: 1.5em;
	color: var(--text);
}

.contact-side h2 {
	font-size: var(--step-card-title);
	font-weight: bold;
	line-height: 1.2;
	color: var(--accent);
}

.email-address {
	font-weight: bold;
	word-break: break-all;
}

/* ------------
   Socials
------------- */

.social-list {
	list-style: none;
	padding: 0;
	display: grid;
	gap: 0.5rem;
}

.social-list a {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.65rem 1rem;
	border-radius: 15px;
	background: var(--bg);
	text-decoration: none;
	font-weight: bold;
	color: var(--ink);
	min-height: 3rem;
	transition: transform 0.15s, background-color 0.15s;
}

.work-text .social-list a {
	text-decoration: none;
}

.social-list a:hover,
.work-text .social-list a:hover {
	color: var(--accent);
	background: var(--hover-tint);
	transform: translateX(0.25rem);
	text-decoration: none;
}

.social-list .handle {
	margin-left: auto;
	font-weight: normal;
	opacity: 0.85;
}

/* ------------
   Footer
------------- */

.site-footer {
	grid-area: footer;
	padding: 0 0.5rem;
	font-size: 0.95rem;
	color: var(--muted);
}

/* ------------
   Tablet & mobile
------------- */

@media (max-width: 48rem) {
	.page {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas:
			"header"
			"main"
			"footer";
	}

	.site-header {
		grid-template-columns: 1fr;
		grid-template-areas:
			"tools"
			"brand"
			"sub";
		padding-right: 3.5rem;
		padding-top: 1rem;
	}

	.header-tools {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		flex-wrap: wrap;
		gap: 0.5rem 1rem;
		margin-left: 0.2rem;
	}

	.clock-container {
		padding-top: 0;
	}

	.big-heading {
		margin-top: 0.25em;
	}

	/* Hamburger menu */
	.site-nav {
		position: fixed;
		top: 0.75rem;
		right: 0.75rem;
		z-index: 50;
	}

	.nav-toggle {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 3rem;
		height: 3rem;
		margin-left: auto;
		padding: 0;
		border: 0;
		border-radius: 50%;
		background: var(--card);
		box-shadow: 0 2px 8px var(--float-shadow);
		cursor: pointer;
	}

	.nav-toggle-bars,
	.nav-toggle-bars::before,
	.nav-toggle-bars::after {
		display: block;
		width: 1.4rem;
		height: 3px;
		border-radius: 2px;
		background: var(--ink);
		transition: transform 0.2s, background-color 0.2s;
	}

	.nav-toggle-bars {
		position: relative;
	}

	.nav-toggle-bars::before,
	.nav-toggle-bars::after {
		content: "";
		position: absolute;
		left: 0;
	}

	.nav-toggle-bars::before { top: -7px; }
	.nav-toggle-bars::after { top: 7px; }

	.site-nav.open .nav-toggle-bars {
		background: transparent;
	}

	.site-nav.open .nav-toggle-bars::before {
		transform: translateY(7px) rotate(45deg);
		background: var(--accent);
	}

	.site-nav.open .nav-toggle-bars::after {
		transform: translateY(-7px) rotate(-45deg);
		background: var(--accent);
	}

	.js .nav-list {
		position: absolute;
		top: calc(100% + 0.5rem);
		right: 0;
		width: min(18rem, calc(100vw - 1.5rem));
		padding: 0.5rem;
		border-radius: 1.5rem;
		background: var(--card);
		box-shadow: 0 0.5rem 1.5rem var(--float-shadow);
		visibility: hidden;
		opacity: 0;
		transform: translateY(-0.5rem);
		transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
	}

	.js .site-nav.open .nav-list {
		visibility: visible;
		opacity: 1;
		transform: none;
	}

	.js .nav-list a {
		padding: 0.8rem 1rem;
		border-radius: 1rem;
		font-size: 1.4rem;
	}

	.js .nav-list a:hover,
	.js .nav-list a:focus-visible {
		background: var(--bg);
	}

	/* Without JavaScript the menu is just a list of links under the header */
	html:not(.js) .site-nav {
		position: static;
		grid-area: nav;
	}

	html:not(.js) .page {
		grid-template-areas:
			"header"
			"nav"
			"main"
			"footer";
	}

	html:not(.js) .nav-list {
		display: flex;
		flex-wrap: wrap;
		gap: 0 0.5rem;
		margin-bottom: 1rem;
	}

	.work {
		border-radius: 1.75rem;
	}

	.work-media {
		max-width: none;
	}
}

/* Contact form buttons shouldn't be squeezed on tiny screens */
@media (max-width: 24rem) {
	.btn-row .btn {
		width: 100%;
		justify-content: center;
	}
}

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

	*,
	*::before,
	*::after {
		transition: none !important;
	}
}
