/* ==========================================================================
   Xtrendence, responsive layer
   Desktop rules live in portfolio.css; everything here narrows them down.
   ========================================================================== */

/* Wide desktop ----------------------------------------------------------- */

@media screen and (min-width: 1500px) {
	:root {
		--shell: min(1280px, 100% - 64px);
	}
}

/* Laptop ----------------------------------------------------------------- */

@media screen and (max-width: 1080px) {
	.about-grid {
		grid-template-columns: 1fr;
	}

	.side-stack {
		flex-direction: row;
		flex-wrap: wrap;
	}

	.side-stack > * {
		flex: 1 1 280px;
	}

	.nav-link {
		padding: 0 12px;
		font-size: 13px;
	}
}

/* Tablet ----------------------------------------------------------------- */

@media screen and (max-width: 900px) {
	:root {
		--shell: min(1180px, 100% - 36px);
	}		

	.search {
		margin-left: 0;
		width: 100%;
	}
}

/* ==========================================================================
   Phone: the top pill becomes a bottom icon dock
   ========================================================================== */

@media screen and (max-width: 820px) {
	:root {
		--shell: min(1180px, 100% - 32px);
	}

	body {
		/* Room for the dock so it never sits on top of the footer. */
		padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px));
	}

	.nav {
		top: auto;
		bottom: calc(14px + env(safe-area-inset-bottom, 0px));
		width: max-content;
		max-width: calc(100% - 24px);
		padding: 6px;
		gap: 2px;
	}

	.nav.nav--tucked {
		/* Slide down and away, not up into the notch. */
		transform: translate(-50%, 190%);
	}

	.nav-brand {
		display: none;
	}

	.nav-links {
		gap: 0;
	}

	.nav-link {
		width: 46px;
		height: 44px;
		padding: 0;
		justify-content: center;
	}

	.nav-link span {
		display: none;
	}

	.nav-link svg {
		display: block;
		width: 19px;
		height: 19px;
	}

	.nav-actions {
		margin-left: 2px;
		padding-left: 5px;
	}

	.icon-btn {
		width: 42px;
		height: 44px;
	}

	.icon-btn svg {
		width: 18px;
		height: 18px;
	}

	/* Hero */

	.hero {
		min-height: auto;
		padding: 116px 0 54px;
	}

	.hero-inner {
		gap: 20px;
	}

	.avatar {
		width: 100px;
		height: 100px;
	}

	.scroll-cue {
		display: none;
	}

	.hero-actions .btn {
		flex: 1 1 auto;
		min-width: 150px;
	}

	.hero-stats {
		grid-template-columns: repeat(2, 1fr);
		margin-top: 32px;
	}

	/* A 2x2 grid needs the divider between columns, not between every tile. */
	.stat + .stat::before {
		display: none;
	}

	.stat:nth-child(even)::before {
		display: block;
	}

	.stat:nth-child(n + 3) {
		border-top: 1px solid var(--hairline);
	}

	/* Sections */

	.section {
		padding: 62px 0;
		scroll-margin-top: 24px;
	}

	.section-head {
		margin-bottom: 30px;
	}

	.panel,
	.role,
	.specialism,
	.skill-card {
		padding: 24px;
	}

	.timeline {
		padding-left: 0;
	}

	.timeline::before {
		display: none;
	}

	/* The rail is gone, so the node becomes a cap across the top of the card. */
	.role::before {
		display: none;
	}

	.role--current::before {
		display: block;
		top: 0;
		left: 26%;
		right: 26%;
		width: auto;
		height: 2px;
		border: none;
		border-radius: 0 0 4px 4px;
		background: var(--accent-fill);
		box-shadow: 0 0 16px var(--accent-glow);
	}

	.project-grid {
		grid-template-columns: 1fr;
	}

	.filters {
		/* Swipe through filters rather than wrapping to three rows. */
		flex-wrap: nowrap;
		overflow-x: auto;
		scrollbar-width: none;
		padding-bottom: 2px;
		-webkit-overflow-scrolling: touch;
	}

	.filters::-webkit-scrollbar {
		display: none;
	}

	.filter {
		flex: none;
	}

	.contact-links {
		grid-template-columns: repeat(3, 1fr);
	}

	.footer {
		margin-top: 56px;
		padding: 30px 0;
	}

	.footer-inner {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
	}
}

/* Small phone ------------------------------------------------------------ */

@media screen and (max-width: 560px) {
	body {
		font-size: 15.5px;
	}

	.hero-role {
		/* Stack the rotator under its lead-in so long phrases never clip. */
		flex-direction: column;
		gap: 2px;
	}

	.rotator {
		justify-items: center;
		text-align: center;
	}

	.hero-actions {
		width: 100%;
	}

	.hero-actions .btn {
		width: 100%;
		flex: 1 1 100%;
	}

	.stat {
		padding: 16px 8px;
	}

	.panel,
	.role,
	.specialism,
	.skill-card,
	.contact-panel {
		padding: 20px;
	}

	.side-stack {
		flex-direction: column;
	}

	.contact-links {
		grid-template-columns: repeat(2, 1fr);
	}

	.contact-link {
		padding: 18px 10px;
	}					
}

@media screen and (max-width: 380px) {
	.nav-link {
		width: 40px;
	}

	.icon-btn {
		width: 38px;
	}

	.contact-links {
		grid-template-columns: 1fr;
	}
}

/* ==========================================================================
   Touch and small-viewport performance
   Stacked backdrop-filters are expensive on phones, so thin them out.
   ========================================================================== */

@media (hover: none) {
	.glass--lit::after {
		display: none;
	}

	.project-card:hover,
	.contact-link:hover,
	.btn:hover {
		transform: none;
	}
}

@media screen and (max-width: 820px) {
	.blob {
		filter: blur(70px);
	}

	.project-card,
	.chip,
	.filter {
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
	}

	.project-card {
		background: var(--glass-bg-strong);
	}
}

/* Landscape phones: the dock plus a full-height hero leaves no room to read. */
@media screen and (max-height: 520px) and (orientation: landscape) {
	.hero {
		min-height: auto;
		padding: 96px 0 40px;
	}

	.scroll-cue {
		display: none;
	}
}
