/**
 * Theme Name: GBC
 * Template:   twentytwentyfive
 */

/*
* Variables
* --------------------------------------------------
*/
:root {
  --black: #333;
  --dark-blue: #1b2a50;
  --mid-blue: #1a70cb;
  --pale-blue: #eceff9;
  --pale-blue-saturated: #e2eefc;
  --red: #e42125;
  --pale-grey: #ccc;
  --palest-grey: #f4f4f4;
  --white: #fff;
  --font-normal: "Open Sans", arial, verdana, sans-serif;
  --font-heading: "Quicksand", arial, verdana, sans-serif;
}

html {
  scroll-behavior: smooth;
}

/* Responsive sizes for the main content containers */
/* Note these override ones set in the Wordpress GUI. */
/* at Appearance > Editor > Styles > Layout. */
.content-container {
  width: 90%;
  margin: 0 auto;
}

@media (min-width: 600px) {
  .content-container {
    width: 80%;
  }
  main .content-container,
  main.content-container {
    width: 65%;
  }
}

.full-width {
  width: 100vw;
  position: relative;
  margin-left: -50vw;
  left: 50%;
  .content-container {
    padding-left: 5px;
  }
}

/* Put the brand colours on the "Skip to content" box. */
.skip-link.screen-reader-text:focus {
  background-color: var(--mid-blue);
  color: var(--white);
}

/* Set the :focus outline colour (white for the areas with a dark background). */
* {
  outline-color: var(--mid-blue);
}
.header-callout a,
footer a {
  outline-color: var(--white);
}

/*
* Header
* --------------------------------------------------
*/
/* Add extra space between the logo and main nav */
.custom-logo {
  margin-right: 10px;
}

/* Make the header sticky */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--white);
  box-shadow: 10px 0 5px -2px rgba(0, 0, 0, 0.3);
}

/*
* Main menu styles
* -------------------------------------------------
*/

/* Increase the default font weight to make the links clearer */
.wp-block-navigation
  .wp-block-navigation-item__content.wp-block-navigation-item__content
  span {
  font-weight: 500;
}

/* Override default Twentytwentyfive style and hide the horizontal main nav from this breakpoint */
@media (min-width: 600px) {
  .wp-block-navigation__responsive-container:not(.hidden-by-default):not(
      .is-menu-open
    ) {
    bottom: 0;
    display: none;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
  }
}

/* Hide social links at end of main nav when screen is too small */
@media (max-width: 1200px) {
  header .wp-block-social-links {
    display: none;
  }
}

/* Show the full horizontal main nav from this breakpoint */
@media (min-width: 1000px) {
  .wp-block-navigation__responsive-container:not(.hidden-by-default):not(
      .is-menu-open
    ) {
    background-color: inherit;
    display: block;
    position: relative;
    width: 100%;
    z-index: auto;
  }
}

/* Show the mobile menu up to this breakpoint */
@media (max-width: 999px) {
  .wp-block-navigation__responsive-container-open:not(.always-shown) {
    display: flex;
    border: 1px solid #666;
    padding: 5px;
    border-radius: 3px;
  }

  /* Make menu headings bold */
  .has-child > .wp-block-navigation-item__content {
    font-weight: bold;
  }

  .wp-block-navigation
    .has-child
    > .wp-block-navigation-item__content.wp-block-navigation-item__content {
    color: var(--mid-blue);
    outline: none;
  }

  .wp-block-navigation
    .has-child
    .has-child
    > .wp-block-navigation-item__content.wp-block-navigation-item__content {
    color: var(--black);
  }

  /* Position hamburger menu to right */
  .header-container {
    position: relative;

    nav {
      position: absolute;
      right: 0;
    }

    .wp-block-navigation__responsive-container.is-menu-open
      .wp-block-navigation__responsive-container-content
      .wp-block-navigation__submenu-container {
      padding-top: 0;
      padding-bottom: 0;
    }

    .current-menu-item {
      text-decoration: underline;
    }
  }

  /* Decrease space at top of mobile menu when no admin bar */
  .wp-block-navigation__responsive-container.is-menu-open
    .wp-block-navigation__responsive-container-content {
    padding-top: 2rem;
  }

  /* Add extra space to moble menu items */
  header .wp-block-navigation .wp-block-navigation-item {
    padding: 5px 0 5px;
  }

  /* Align mobile menu items to right */
  .wp-block-navigation {
    /* --navigation-layout-justification-setting: flex-end;
    --navigation-layout-direction: row;
    --navigation-layout-wrap: wrap;
    --navigation-layout-justify: flex-end; */
  }
}

/*
 * Make main nav text uppercase
 */
header .wp-block-navigation-item__content {
  text-transform: uppercase;
  text-decoration: none;
}

header
  .wp-block-navigation
  .wp-block-navigation-item__content.wp-block-navigation-item__content:hover {
  color: var(--mid-blue);
}

/* Nudge the dropdown subnavs down from the parent link */
header > .has-child > .wp-block-navigation-item__content {
  padding: 10px 0 10px;
}

.wp-block-navigation__submenu-container li:first-child {
  padding-top: 10px;
}

.wp-block-navigation__submenu-container li:last-child {
  padding-bottom: 10px;
}

/* Move the submenus so they left-align with the main menu link */
.wp-block-navigation.items-justified-right
  .wp-block-navigation__container
  .has-child
  .wp-block-navigation__submenu-container,
.wp-block-navigation.items-justified-right
  .wp-block-page-list
  > .has-child
  .wp-block-navigation__submenu-container,
.wp-block-navigation.items-justified-space-between
  .wp-block-page-list
  > .has-child:last-child
  .wp-block-navigation__submenu-container,
.wp-block-navigation.items-justified-space-between
  > .wp-block-navigation__container
  > .has-child:last-child
  .wp-block-navigation__submenu-container {
  left: 0;
}

@media (max-width: 780px) {
  footer .is-layout-flow > .alignright {
    float: left;
    margin-inline-start: 0;
  }
}

/* Align the main menu in footer with the secondary links */
footer .wp-block-navigation__container {
  gap: 0.5rem;
}

.wp-block-navigation-is-layout-flex {
  margin-block-start: 0.5rem;
}

/* Additional styles for the cookie banner. You can't put hover styles
* in the GUI. */
.cky-notice {
  button.cky-btn:hover {
    border-color: var(--mid-blue) !important;
    opacity: 1 !important;
  }
  button.cky-btn-accept:hover {
    background-color: var(--mid-blue) !important;
  }
}

/*
* "Sign the GBC Open Letter" banner
* --------------------------------------------------
*/
/* Make the banner clickable */
.header-callout {
  text-transform: uppercase;
  text-align: center;

  a {
    text-decoration: none;
    display: block;
    color: var(--white);
    padding: 12px;
  }

  a:hover {
    text-decoration: underline;
  }
}

/* Remove default block spacing just for footer */
:where(.wp-site-blocks) > footer {
  margin-block-start: 0;
}

/* Blog, News and Impact Studies blue banner header.
* This is different to the normal page header blue banner. The
* normal page headers include the page title placeholder. The blog, news
* and Impact Studies headers contain static text e.g. "Blog" 
* (a link back to the blog home).
*/
.single-post-header a {
  font-family: var(--font-heading);
  display: block;
  text-decoration: none;
  font-weight: 500;
  font-size: clamp(1.502rem, 1.502rem + ((1vw - 0.2rem) * 1.565), 2.5rem);
  &:hover {
    text-decoration: underline;
  }
}

/*
* Main content area
* --------------------------------------------------
*/

/* Keep link underline on hover. There doesn't appear to be a way 
* to do this via the GUI. The default behaviour is for the underline
* to disappear on hover. */
:root :where(a:where(:not(.wp-element-button)):hover) {
  text-decoration: underline;
}

/* Remove mysterious space under <h3>s */
.is-layout-flex > :is(h3) {
  margin-bottom: -0.75rem;
}

/* Add transition to button hover */
.wp-block-button__link {
  transition: background-color 0.2s ease-in-out;
  &:hover {
    background-color: var(--dark-blue);
  }
}

/* Add spacing before h2 headers in the content area */
main p + h2.wp-block-heading,
main ul + h2.wp-block-heading {
  margin-top: 1.25em;
}

/* For the 404 page */
main .page-list ul li:first-child {
  padding-top: 0;
}

/* Set default spacing around h3 and ul */
:root :where(.is-layout-flow) > h3 + ul,
:root :where(.is-layout-constrained) > h3 + ul {
  margin-block-start: 0.25rem;
}

:root main :where(.is-layout-constrained) p + ul {
  margin-block-start: 0.25rem;
}

:root main :where(.is-layout-flow) > h3 + p {
  margin-block-start: 0.25rem;
}

/* List styles */
main li::marker {
  color: var(--dark-blue);
}

/* Table styles */
/* Note: these are set here, not in the GUI. */
.wp-block-table table {
  border: 0;
  margin: 0 0 2rem;
  thead {
    border-bottom: 2px solid var(--mid-blue);
    text-align: left;
    th {
      border: 0;
      padding: 0.75em;
      font-weight: normal;
      font-size: 1.25rem;
    }
  }
  td {
    border: 0;
    vertical-align: top;
    border-bottom: 1px solid var(--pale-grey);
    padding: 0.75em;
  }
}

/* Add this class to a table to make the first column text bold.
* Note: Wordpress embeds tables in the <figure> element */
figure.first-column-bold {
  td:nth-of-type(1) {
    font-weight: bold;
  }
}

figure.first-column-25 {
  th:nth-of-type(1) {
    width: 25%;
  }
}

/*
* Styles for the events tables.
* These are flexbox rows ("rows" on WordPress) with two columns.
* There is a WordPress pattern for these tables. Notice the rows
* need to be wrapped in a "Group" block with a class of "events".
*/
.events {
  border-top: 2px solid var(--mid-blue);
  margin-bottom: 3rem;
  .wp-block-group {
    margin-block-start: 0;
  }
  .wp-block-columns {
    width: 100%;
    border: 1px solid var(--pale-grey);
    border-width: 0 0 1px;
    padding: 0.75em;
    margin: 0;
    .wp-block-column:first-child {
      flex-basis: 20%;
    }
    .wp-block-column + .wp-block-column {
      flex-basis: 80%;
    }
  }
}

/* Small screen tweaks for the events tables */
@media (max-width: 782px) {
  /* Close the default gap between the date and description */
  :root .events :where(.wp-block-columns-is-layout-flex) {
    gap: 0.25rem !important;
  }

  .events .wp-block-column:first-child {
    font-weight: bold;
  }
}

/* Style for GBC resource reviewers' table, to position
*  the ORCID logo.*/
.committee-table td img {
  position: relative;
  top: 5px;
  border: 0 !important;
}

/* Styles for the GBC resources list */
.page-id-2017 main {
  .wp-block-columns {
    border-bottom: 1px solid var(--pale-grey);
    padding-bottom: 1.25em;
    &:nth-of-type(1) {
      border-top: 1px solid var(--pale-grey);
      margin-top: 2em;
      padding-top: 1.25em;
    }
  }
  .wp-block-heading {
    font-size: 1.3rem;
  }
}

/* Styles for the "latest signatures" sidebar */
.big-number {
  font-size: 3rem;
  margin: 0 0 1rem;
  color: var(--mid-blue);
}

.signature {
  border: 1px solid #ddd;
  border-left: 3px solid var(--mid-blue);
  background: var(--palest-grey);
  padding: 15px;
  margin: 0 0 10px;
  line-height: 1.2;
  h3,
  div {
    margin: 0 0 5px;
  }

  h3 + div {
    margin-bottom: 5px;
  }

  h3 {
    font-size: 1.3rem;
  }
}

/* Styles for the Open Letter form */
.letter-form {
  padding: 10px 15px 30px;
  margin: 2.5rem 0 0.25rem;
  input,
  textarea,
  select,
  button,
  option {
    padding: 5px;
    margin: 3px 0 0;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 100%;
    border: 1px solid #bbb;
    border-radius: 5px;
    background: var(--white);
  }

  select,
  input:not([type="checkbox"], [type="submit"]) {
    width: clamp(300px, 100%, 350px);
  }

  .description {
    font-size: 0.9rem;
    margin-top: 0;
  }

  input:not([type="checkbox"]) {
    height: 2rem;
  }

  input[type="checkbox"] {
    margin-top: 0.75rem;
  }

  input[type="submit"] {
    background-color: var(--mid-blue);
    transition: background-color 0.3s ease-in-out;
    color: var(--white);
    padding: 0 20px;
    border: 0;
    height: 2.5rem;
    margin-top: 0.5rem;
    &:hover {
      cursor: pointer;
      background-color: var(--dark-blue);
    }
    &:focus {
      outline-color: var(--black);
    }
  }

  select {
    option {
      font-family: "Open Sans", arial, verdana, sans-serif;
      background: var(--white);
    }
  }
}

@media (min-width: 450px) {
	.letter-form {
	  padding: 10px 30px 30px;
	}
  }

.wpcf7 form.sent .wpcf7-response-output,
.wpcf7 form.invalid .wpcf7-response-output {
  border-color: var(--red);
  background: #fff;
  margin-top: 0rem;
  border-radius: 5px;
  padding: 20px;
  z-index: 100;
  position: relative;
}

/* For the signatures search form on the signatures page */
.search-form {
  display: none;
  margin-top: 2.5rem;
  input[type="text"],
  button {
    line-height: 1.5;
    font-size: 1.1rem;
    font-family: var(--font-normal);
    vertical-align: middle;
  }
  input[type="text"] {
    padding: 5px;
    width: 15rem;
  }
  button {
    background-color: var(--dark-blue);
    border: 0;
    color: var(--white);
    border-radius: 3px;
	margin-right: 5px;
    padding: 5px 15px 7px;
    transition: background-color 0.2s ease-in-out;
    &:hover {
      background-color: var(--red);
      cursor: pointer;
    }
  }
  #reset-search {
    padding: 0 10px;
    font-size: 0.9rem;
  }
}

/* For the signatures page.
* Note that you can also use a Query Loop block in the Wordpress GUI
* to get the signatures, but it's not as flexible.
*/
.signatures-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin: 2.5em 0;
  .signature-item {
    border: 1px solid var(--pale-grey);
    padding: 15px;
    border-radius: 5px;
  }
  h2 {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
    font-weight: bold;
  }
}

.signatures-grid + .signatures-grid {
  margin-top: -1.5rem;
}

.search-results {
  background: var(--pale-blue);
  h2 {
    font-size: 1.5rem;
    margin: 0.75rem 0;
  }
  .signature-item {
    background: var(--white);
    h3 {
      margin: 0;
    }
  }
  .signatures-grid {
    margin-top: 0;
  }
}


/* For WordPress pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 1rem 0;
	padding-bottom: 3rem;
	.page-numbers {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 40px;
		height: 40px;
		padding: 0 12px;
		border: 1px solid var(--dark-blue);
		color: var(--dark-blue);
		border-radius: 3px;
		text-decoration: none;
		transition: all 0.2s ease;
	}
	a.page-numbers:hover {
		border-color: var(--red);
		background-color: var(--red);
		color: var(--white);
	}
	.page-numbers.current {
		border-color: var(--red);
		background-color: var(--red);
		color: var(--white);
	}
	.page-numbers.dots {
		border: 0;
	}
}

/* Pagination tweaks for mobile */
@media (max-width: 600px) {
	.pagination {
		gap: 6px;
		.page-numbers {
			min-width: 36px;
			height: 36px;
			padding: 0 10px;
		}
	}
}

/* Float styles */
/* Notice that for floats to work in the content area
* they need to be in a "Group" block, together with the 
* elements they are floated next to.
* The "alignleft/right" classes are the ones WordPress 
* adds when you align an image.
*/
figure.alignright {
  padding: 5px 0 30px 30px;
}

figure.alignleft {
  padding: 0 30px 30px 0;
}

@media (max-width: 600px) {
  .is-layout-flow > figure.alignright,
  .is-layout-flow > figure.alignleft {
    padding: 0;
    float: none;
    margin-inline-start: 0;
  }
}

/* Changing the Wordpress default media sizes through the
* "Settings > Media" route did not work.
*/
.small {
  width: 200px;
}

.medium {
  width: 500px;
}

/*
* Utility styles
*/
/* Hide except for screen readers */
.sr-only,
.wp-block-column:first-child em {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* For hiding elements even from screen readers, and showing them with JavaScript.
 * This is used for the email verification message on the Open Letter page. */
.invisible {
  display: none !important;
}

.tinted {
  background-color: var(--pale-blue);
}

.events .tinted {
  background-color: var(--pale-blue-saturated);
}

.tolowercase {
  text-transform: capitalize;
}

.italic {
  font-style: italic;
}

.m-0 {
  margin: 0 !important;
}

.mt-0 {
  margin-top: 0 !important;
}

.no-bullet {
  list-style: none;
  padding-left: 0;
  li {
    padding-bottom: 0.5rem;
  }
}

.x-bottom-padding li {
  padding-bottom: 0.25rem;
}

/*
* Enable a link to wrap a block of several elements. You can't
* do this through the GUI. The parent block needs a class of
* "block-link" and the element containing the link inside needs a class of "block-link-target".
* Note that you can't put a class on links within text via the GUI. You
* can put the link on the heading, though. See the "Take Action" page for an example.
* Colours set through the GUI will override the colours set here.
*/
.block-link {
  position: relative;
  border: 1px solid var(--mid-blue);
  border-bottom: 2px solid var(--red);
  transition: background-color 0.3s ease-out;
  background-color: var(--white);
  border-radius: 10px;

  &:hover,
  &:focus-within {
    cursor: pointer;
    background-color: var(--pale-blue);
    /* filter: drop-shadow(0px 0px 5px #bbb); */
  }

  h2 a {
    text-decoration: none;
    color: #444;
    &:hover {
      text-decoration: none;
      color: var(--mid-blue);
    }
  }

  .block-link-target a:before {
    content: "";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
}

/* Styles for displaying a lists of posts as tiles. 
* Note that the code is generated in functions.php, to give control
* over the HTML tags used. */
.tiled-posts {
  display: grid;
  gap: 30px;
  grid-template-columns: repeat(2, 1fr);
  div {
    padding: 0 20px 5px;
  }
  h2 {
    font-size: 1.4rem;
    line-height: 1.25;
  }
  p {
    font-style: italic;
    margin: 1rem 0;
  }
}

@media (max-width: 600px) {
  .tiled-posts {
    grid-template-columns: 1fr;
  }
}

/* Styles for the single-post template. This is for the native "Recent" or
* "More posts" block at the end of the page (e.g. see a news story). 
* Note it is styled like the Events tables, but the underlying code is different. */
.more-posts {
  li {
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--pale-grey);
    &:nth-of-type(1) {
      border-top: 2px solid var(--mid-blue);
    }
  }
  h3 {
    margin: 0;
    width: 80%;
  }
  time {
    color: var(--black);
  }
}

.impact-studies {
  p {
    margin: 0.5rem 0;
  }
}

/* Add a border and hover style to linked images */
.entry-content a > img {
  border: 2px solid var(--palest-grey);
  transition: border-color 0.2s ease-out;
  &:hover {
    border-color: var(--red);
  }
}
