/* Site styles, layered on top of Sphinx's basic theme.
 *
 * Custom properties for the palette/fonts, native CSS nesting, and
 * breakpoints written inline in the media queries.
 */

:root {
	/* Colors */
	--color-brand-primary: #27ae60;
	--color-black: #231f20;
	--color-black-shadow: rgba(0, 0, 0, .05);
	--color-blue: #4582ec;
	--color-pink: #f5a2c6;
	--color-dark-pink: #e18eb2;
	--color-gray: #636466;
	--color-dark-gray: #414042;
	--color-medium-gray: #d0d0d0;
	--color-light-gray: #e7e7e7;
	--color-lightest-gray: #f2f3f3;
	--color-white: #fff;

	/* Typography */
	--base-font-size: 16px;
	--font-stack: "Work Sans", "Raleway", sans-serif;
	--serif: Georgia, serif;
	--sans-serif: Arial, sans-serif;

	/* Navigation */
	--nav-height: 60px;
}

html {
	/* Keep anchor targets clear of the pinned navbar. Offsetting the scroll
	   port covers same-page clicks, cross-page links, and load-time
	   #fragments in one rule -- the navbar no longer hides the target. */
	scroll-padding-top: var(--nav-height);
}

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

/* ==================================================
   Grid
   ================================================== */
.container {
	margin-right: auto;
	margin-left: auto;
	padding-left: 15px;
	padding-right: 15px;
}
@media (min-width: 768px) {
	.container { width: 750px; }
}
@media (min-width: 992px) {
	.container { width: 970px; }
}

.row {
	display: flex;
	flex-wrap: wrap;
	margin-left: -15px;
	margin-right: -15px;
}

[class^="col-"],
[class*=" col-"] {
	position: relative;
	min-height: 1px;
	padding-left: 15px;
	padding-right: 15px;
}

.col-xs-4 { width: 33.33333%; }
.col-xs-8 { width: 66.66667%; }

@media (min-width: 768px) {
	.col-sm-2  { width: 16.66667%; }
	.col-sm-6  { width: 50%; }
	.col-sm-10 { width: 83.33333%; }
	.col-sm-12 { width: 100%; }
}

@media (min-width: 992px) {
	.col-md-12 { width: 100%; }
}

@media (max-width: 991px) {
	.hidden-xs, .hidden-sm { display: none !important; }
}
@media (min-width: 992px) {
	.visible-xs, .visible-sm { display: none !important; }
}

.text-right { text-align: right; }

/* ==================================================
   Hamburger menu button ('squeeze' style, from jonsuh/hamburgers)
   ================================================== */
.hamburger {
	padding: 15px 15px;
	display: inline-block;
	cursor: pointer;
	transition-property: opacity, filter;
	transition-duration: .15s;
	transition-timing-function: linear;
	font: inherit;
	color: inherit;
	text-transform: none;
	background-color: transparent;
	border: 0;
	margin: 0;
	overflow: visible;
}
.hamburger:hover { opacity: .7; }

.hamburger-box {
	width: 30px;
	height: 21px;
	display: inline-block;
	position: relative;
}

.hamburger-inner {
	display: block;
	top: 50%;
	margin-top: -1.5px;
}
.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {
	width: 30px;
	height: 3px;
	background-color: #fff;
	border-radius: 4px;
	position: absolute;
	transition-property: transform;
	transition-duration: 0.15s;
	transition-timing-function: ease;
}
.hamburger-inner::before,
.hamburger-inner::after {
	content: "";
	display: block;
}
.hamburger-inner::before { top: -9px; }
.hamburger-inner::after { bottom: -9px; }

.hamburger--squeeze .hamburger-inner {
	transition-duration: 0.1s;
	transition-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
}
.hamburger--squeeze .hamburger-inner::before {
	transition: top 0.1s 0.14s ease, opacity 0.1s ease;
}
.hamburger--squeeze .hamburger-inner::after {
	transition: bottom 0.1s 0.14s ease, transform 0.1s cubic-bezier(0.55, 0.055, 0.675, 0.19);
}
.hamburger--squeeze.is-active .hamburger-inner {
	transform: rotate(45deg);
	transition-delay: 0.14s;
	transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
.hamburger--squeeze.is-active .hamburger-inner::before {
	top: 0;
	opacity: 0;
	transition: top 0.1s ease, opacity 0.1s 0.14s ease;
}
.hamburger--squeeze.is-active .hamburger-inner::after {
	bottom: 0;
	transform: rotate(-90deg);
	transition: bottom 0.1s ease, transform 0.1s 0.14s cubic-bezier(0.215, 0.61, 0.355, 1);
}

/* ==================================================
   Base
   ================================================== */
/* Border-box everywhere, so a column's width% + padding stays within its row. */
*, *::before, *::after {
	box-sizing: border-box;
}

html {
	font-size: var(--base-font-size); /* base font size = 16px */
	position: relative;
	min-height: 100%;
	-webkit-text-size-adjust: 100%;
	-ms-text-size-adjust: 100%;
	-ms-overflow-style: scrollbar; /* IE scrollbar hack */

	@media (min-width: 1921px) {
		font-size: var(--base-font-size); /* base font size = 16px */
	}
}

body {
	font-family: var(--font-stack);
	font-size: 100%; /* base font size = 16px */
	margin: 0;
	padding: 0;
	background-color: var(--color-white);

	@media (min-width: 1921px) {
		font-size: 150%;
	}
}

body.casebook {
	background-color: var(--color-white);
}

body, button, input, select, textarea {
	line-height: 1.618;
}

.container {
	position: relative;
}

@media (min-width: 1200px) {
	.container {
		width: calc(100% - 16.66666666%);
	}
}

.content {
	margin-top: 15px;
}

.attribution {
	font-size: 80%;
	font-style: italic;
}

/* ==================================================
   Scenarios
   ================================================== */
.scenario {
	/* Explicitly inherit theme from the body */
	.label {
		color: inherit;
		font-family: inherit;
		font-size: inherit;
		font-weight: inherit;
		padding: inherit;
	}

	.title {
		font-weight: bold;
		text-decoration: underline;
	}

	/* Create a divider line between scenarios. */
	&::after {
		border-radius: 4px;
		border-top: 1px solid var(--color-gray);
		box-shadow: inset 0 1px 1px var(--color-black-shadow);
		content: ' ';
		display: block;
		padding-top: 15px;
	}

	&:last-child {
		&::after {
			border: 0;
			padding-top: 0;
		}
	}
}

/* ==================================================
   Typography
   ================================================== */
h1, h2, h3, h4, h5, h6 {
	margin: 0 0 10px 0;
	font-weight: 700;
	font-family: var(--font-stack);
	line-height: 1.3;
	color: var(--color-black);
	font-feature-settings: "lnum" 1;
	font-variant-numeric: lining-nums;

	& a, & a:hover {
		text-decoration: none;
	}
}

h1 {
	padding: 10px 15px;
	margin-bottom: 25px;
	font-size: 2rem;
	background-color: var(--color-light-gray);
}

.casebook h1 {
	margin-bottom: 25px;
	background-color: #f9d1e2;
}

h2 {
	font-size: 1.75rem;
}

h3 {
	font-size: 1.5rem;
	color: #888;
}

h4 {
	font-size: 1.25rem;
}

h5 {
	font-size: 1.125rem;
}

h6 {
	font-size: .9375rem;
	font-weight: 700;
	text-transform: uppercase;
}

small {
	font-size: .75rem;
	font-family: var(--sans-serif);

	@media (min-width: 1921px) {
		font-size: 0.851rem !important;
	}
}

p {
	margin: 0 0 25px;

	&:empty {
		display: none;
	}
}

p, li, ol {
	line-height: 1.4;

	@media (min-width: 1921px) {
		font-size: 1.5rem !important;
	}
}

ul,
ol {
	margin-top: 0;
	margin-bottom: 25px;
}

/* Keep nested lists tight and definition lists flush-left. */
ul ul, ol ul, ul ol, ol ol {
	margin-bottom: 0;
}

dl {
	margin-top: 0;
	margin-bottom: 20px;
}

dd {
	margin-left: 0;
}

hr {
	clear: both;
	border-top: solid #e5e5e5;
	border-width: 1px 0 0;
	margin: 25px 0;
	height: 0;
}

blockquote {
	padding: 10px 20px;
	margin: 0 0 20px;
	font-size: 1.125rem;
	font-weight: 700;
	border-left: 5px solid var(--color-pink);

	/* The trailing paragraph (e.g. an epigraph's attribution) drops its
	   bottom margin so the quote box doesn't gain a blank row. */
	p:last-child {
		margin-bottom: 0;
	}

	@media (min-width: 768px) {
		font-size: 1.5rem;
	}
}

/* ==================================================
   Images
   ================================================== */
img {
	border: 0;
	outline: none;
}

/* ==================================================
   Links
   ================================================== */
a {
	outline: none;
	border: 0;
	color: var(--color-blue);
	text-decoration: none;
	transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, opacity 0.15s ease-in-out;

	&:hover,
	&:active,
	&:focus {
		outline: none;
		color: var(--color-black);
	}
}

.content a {
	font-weight: 700;
}

a.headerlink {
	color: var(--color-white) !important;
	position: relative;
}

/* ==================================================
   Nav and Header
   ================================================== */
/* top banner */
.top-banner {
	background-color: var(--color-pink);
	box-shadow: inset 0 -20px 10px rgba(35, 31, 32, 0.2);
	min-height: 34px;
	display: flex;
	justify-content: center;
	align-items: center;
}

.header-announcement {
	text-align: center;
	font-size: .875rem;
	font-weight: 700;
	color: var(--color-black);

	a {
		color: var(--color-white);
	}
}

/* main nav */
.banner {
	/* Dissolve the header box so its children (the announcement bar and the
	   nav) lay out as direct children of <body>. That gives the sticky nav a
	   full-height containing block, so it stays pinned down the whole page. */
	display: contents;

	.nav-main {
		background-color: var(--color-black);
		border: none;
		border-radius: 0;
		z-index: 100;
		padding: 0;

		@media (min-width: 992px) {
			padding: 0 15px;
		}

		@media (min-width: 1200px) {
			padding-left: calc(8.33333333% + 15px);
			padding-right: calc(8.33333333% + 15px);
		}

		.nav-wrap {
			position: relative;
		}
	}

	.brand {
		position: absolute;
		top: 10px;
		left: 15px;
		margin: 0;
		z-index: 101;

		.brandlogo {
			float: left;
			width: 188px;
			height: 40px;
			text-indent: -999em;
			background-image: url(./wftda-logo-hz.svg);
			background-repeat: no-repeat;
			background-size: contain;
			display: inline-block;
		}

		.section-title {
			float: left;
			margin-left: 35px;
			font-family: var(--font-stack);
			font-size: 2.125rem;
			font-weight: 900;
			line-height: 40px;
			color: var(--color-light-gray);
			text-transform: uppercase;

			@media (min-width: 768px) {
				display: block;
			}

			&.site-section-casebook {
				color: var(--color-pink);
			}
		}
	}

	/* Pinned to the top of the viewport. position: sticky keeps it in flow,
	   so the page doesn't reflow when it pins (which would slide anchor
	   targets behind it -- see scroll-padding-top on html). */
	.sticky {
		position: sticky;
		top: 0;
		min-height: var(--nav-height);
	}
}

body .banner .brand {
	.site-section-rules {
		display: block;
	}
	.site-section-casebook {
		display: none;
	}
}

body.casebook .banner .brand {
	.site-section-rules {
		display: none;
	}
	.site-section-casebook {
		display: block;
	}
}

@media (max-width: 480px) {
	body.casebook .banner .brand .section-title,
	body .banner .brand .section-title {
		display: none;
	}
}

/* navigation */
.navbar-header {
	float: none;
	min-height: var(--nav-height);

	@media (min-width: 992px) {
		float: right;
	}
}

.navbar-collapse {
	padding: 0;
	border-top: 0 solid transparent;

	&::after {
		content: '';
		display: table;
		clear: both;
	}
}

.navbar-collapse.collapse {
	display: none; /* hidden by default on phones; .collapse.in opens it */

	@media (min-width: 768px) {
		display: none !important;
		height: 0 !important;
		padding-bottom: 0;
		overflow: visible !important;
	}

	@media (min-width: 992px) {
		display: block !important;
		height: auto !important;
		padding-bottom: 0;
		overflow: visible !important;
	}
}

.collapse.in {
	display: block !important;
	height: auto !important;
}

/* ==================================================
   Menu and Dropdown
   ================================================== */
ul#menu-main-navigation {
	list-style: none;
	margin: 0;
	padding: 0;
	background-color: var(--color-black);

	&::after {
		content: '';
		display: table;
		clear: both;
	}

	@media (min-width: 992px) {
		float: right;
	}

	li {
		margin: 0;
		padding: 0;

		@media (min-width: 992px) {
			float: left;
		}

		a {
			margin: 0;
			padding: 8px 0 8px 15px;
			font-size: 1rem;
			font-weight: 700;
			line-height: 1.618;
			font-family: var(--font-stack);
			color: var(--color-white);
			text-align: left;
			text-shadow: none;
			text-transform: uppercase;
			border: 0 !important;
			border-radius: 0;
			display: block;
			text-decoration: none !important;
			overflow: hidden;
			transition: color 0.25s ease-in-out, background-color 0.25s ease-in-out, opacity 0.25s ease-in-out, box-shadow 0.25s ease-in-out, display 0.25s ease-in-out;

			@media (min-width: 992px) {
				margin: 0 12px;
				padding: 0;
				font-size: 1.25rem;
				line-height: var(--nav-height);
				text-align: center;
				border: 0;
			}

			@media (min-width: 1200px) {
				font-size: 1.25rem;
			}
		}

		/* Anchor the absolutely-positioned menu to its own toggle so it opens
		   directly beneath the matching nav item. */
		&.dropdown {
			position: relative;
		}

		.dropdown-menu {
			margin: 0;
			padding: 0;
			border: 0;
			box-shadow: 0 0 0;
			background-color: var(--color-dark-gray);
			z-index: 999;
			display: none; /* hidden until opened on hover (desktop) or tap (.open) */
			transition: color 0.25s ease-in-out, background-color 0.25s ease-in-out, opacity 2.5s ease-in-out, box-shadow 0.25s ease-in-out, visibility 0.25s ease-in-out;

			@media (min-width: 992px) {
				position: absolute; /* overlay the page content on desktop */
				/* Cap the overlay to the viewport and let it scroll. The
				   singlehtml build's Page menu is the whole document's TOC,
				   which otherwise runs off-screen with no way to reach the end. */
				max-height: calc(100vh - var(--nav-height));
				overflow-y: auto;
			}

			@media (min-width: 1200px) {
				width: 300px;
				left: 0;
				height: 0;
				opacity: 0;
			}

			/* The TOC renders as nested <ul>s; drop the inherited list margins
			   and padding so entries flow flush. */
			ul {
				margin: 0;
				padding: 0;
			}

			li {
				float: none;
				padding: 0;
				margin: 0;
				display: block;
				text-align: left;

				a {
					font-weight: 300;
					text-transform: capitalize;
					/* Size the menu to its widest entry instead of shrinking to
					   the toggle's width and wrapping each row. */
					white-space: nowrap;

					@media (min-width: 992px) {
						padding: 10px 5px;
						font-size: .875rem;
						line-height: 1.2;
						text-align: left;
						text-shadow: 1px 1px 0 var(--color-black);
						text-transform: uppercase;
					}

					/* Highlight instantly, with no background fade. */
					transition: none;

					/* Highlight only the row under the cursor. The TOC nests its
					   <li>s, so the highlight lives on the anchor; a rule on <li>
					   would also match the ancestor <li>s and tint the whole menu. */
					&:hover, &:active, &:focus {
						background-color: var(--color-pink);
					}
				}
			}
		}

		@media (min-width: 992px) {
			&:hover .dropdown-menu {
				display: block;
				opacity: 1;
				height: auto;
			}
		}

		/* Tap to open, where JS toggles .open (no hover). */
		&.open .dropdown-menu {
			display: block;
			opacity: 1;
			height: auto;
		}
	}
}

@media (min-width: 768px) {
	.navbar-nav {
		float: none;

		li {
			float: none;
		}
	}
}

.navbar-nav > li > a:hover {
	border: 0;
}

.nav .open > a, .nav .open > a:hover, .nav .open > a:focus {
	border: 0 !important;
	background-color: transparent;
}

ul#menu-main-navigation > li:hover > a,
ul#menu-main-navigation > li > a:hover {
	outline: 0;
	position: relative;
	background-color: transparent;
	color: var(--color-pink);

	@media (min-width: 992px) {
		box-shadow: inset 0 -5px 0 var(--color-pink);
	}
}

.nav > li > a:focus, .nav > li > a:hover {
	background-color: transparent;
}

.navbar-toggle {
	position: relative;
	float: right;
	padding: 0;
	margin: 20px 15px 0 0;

	@media (min-width: 768px) {
		display: block;
	}
	@media (min-width: 992px) {
		display: none;
	}

	margin-bottom: 0;
	background-color: transparent;
	background-image: none;
	border: 0;
	border-radius: 0;
}

.navbar-form {
	margin-top: 15px;
	margin-right: 0;
	margin-bottom: 0;
	margin-left: 0;
	padding: 0;
}

/* Search input. */
.form-control {
	display: block;
	width: 100%;
	height: 40px;
	padding: 8px 12px;
	font-size: 1rem;
	line-height: 1.42857143;
	color: #555;
	background-color: var(--color-white);
	border: 1px solid #ddd;
	border-radius: 4px;
}

/* Dropdown caret. */
.caret {
	display: inline-block;
	width: 0;
	height: 0;
	margin-left: 2px;
	vertical-align: middle;
	border-top: 4px solid;
	border-right: 4px solid transparent;
	border-left: 4px solid transparent;
}

/* content */
.toctree-wrapper {
	font-size: 1.125rem;

	li {
		margin-top: 4px;
		margin-bottom: 4px;
	}
}

.relations-nav {
	margin: 15px 0 0;
	padding: 0;
	list-style: none;

	li {
		display: inline-block;
		padding: 0 5px;
		margin: 10px 0;
		font-weight: bold;

		@media (min-width: 768px) {
			padding: 0 15px;
		}

		&.vis-sep {
			width: 1px;
			padding: 0;
			border-left: 1px solid var(--color-black);
		}
	}
}

/* ==================================================
   Footer
   ================================================== */
.footer {
	font-size: .875rem;
	border-top: 1px solid var(--color-gray);
	padding-top: 25px;

	div[class*=col-],
	div[class^=col-] {
		padding-bottom: 25px;
	}
}
