/* PaperJewels Olivero subtheme overrides.
 *
 * This file loads after Olivero's stylesheets, so a plain rule here beats an
 * Olivero rule of equal specificity at every breakpoint; there's no need to
 * repeat an override inside Olivero's own media queries.
 *
 * Breakpoints (matching Olivero): 43.75rem (tablet), 75rem (desktop nav).
 *
 * Sections:
 *   1. Variables and base
 *   2. Layout: page, header, main, footer, regions
 *   3. Navigation and search
 *   4. Node and body content
 *   5. Legacy D7 markup
 *   6. Views
 *   7. Utilities
 */


/* ==========================================================================
   1. Variables and base
   ========================================================================== */

:root {
  --pj-accent: #8a4b2d;
  --pj-link: #ad1f32;
  --pj-header-bg: #000;
}

html,
body,
h1, h2, h3, h4, h5, h6,
input,
textarea,
select,
button {
  font-family: 'Special Elite', Georgia, serif;
}

body,
.social-bar {
  background-color: #fff;
  background-image: none;
}

h1 {
  font-size: 36px;
  font-weight: bold;
  line-height: 1.2;
  margin: 15px 0 0;
}

a,
.text-content a {
  color: var(--pj-link);
  text-decoration: none;
}

/* Olivero underlines formatted-text links with an inset box-shadow. */
.text-content.field--name-body a:where(:not(.button)) {
  box-shadow: none;
}

/* Linked images sit as a box; text links stay inline so they wrap. */
.text-content.field--name-body a:where(:not(.button)):has(> img) {
  display: inline-block;
}


/* ==========================================================================
   2. Layout: page, header, main, footer, regions
   ========================================================================== */

.page-wrapper {
  margin: 0 auto;
}

.container {
  max-width: none;
}

.social-bar {
  width: 0;
}

/* 100vw (below) includes the vertical scrollbar's width, so the full-bleed
   elements overhang the page by that much where scrollbars take up space.
   clip (unlike hidden) doesn't make body a scroll container. */
body {
  overflow-x: clip;
}

/* Header and the dark slide band break out of the content column to the
   full viewport width. */
.site-header,
.dark-slide-background .block__content > div {
  position: relative;
  right: 50%;
  left: 50%;
  width: 100vw;
  padding: 25px 0;
  margin-left: -50vw;
  margin-right: -50vw;
  background-color: var(--pj-header-bg);
  text-align: center;
}

.site-header__inner {
  background-color: var(--pj-header-bg);
}

.dark-slide-background {
  margin: 0;
}

.site-branding {
  align-items: flex-start;
}

.site-branding__name a {
  color: var(--pj-accent);
}

main {
  padding-top: 40px;
}

.main-content__container {
  padding-block-start: 0;
}

.site-footer {
  color: var(--color--gray-65);
  background: transparent;
}

.site-footer__inner {
  padding: 0;
}

/* Olivero adds text-decoration plus a highlight band on hover; drop both,
   along with the box-shadow underline, in the footer. */
.site-footer .text-content a,
.site-footer .text-content a:hover {
  text-decoration: none;
  box-shadow: none;
}

/* Not redundant with the global link color: Olivero's
   `.site-footer .text-content a` sets white (for its dark footer), which
   is invisible on our transparent footer background. */
.site-footer .text-content a {
  color: var(--pj-link);
}

.site-footer .text-content a:hover {
  color: var(--color--primary-50);
}

.region > *:where(:not([data-big-pipe-placeholder-id])),
.region--content {
  margin-block-end: 0;
}

.region--footer-bottom.grid-full {
  display: block;
}

@media (max-width: 43.75rem) {
  .site-branding img {
    max-height: none;
  }
}

@media (min-width: 43.75rem) {
  .site-header,
  .site-branding {
    min-height: unset;
  }
}

@media (min-width: 75rem) {
  .main-content {
    width: 100%;
    margin-inline-end: 0;
  }

  body:not(.is-always-mobile-nav) .site-footer {
    border-inline-start: none;
  }
}


/* ==========================================================================
   3. Navigation and search
   ========================================================================== */

#header-nav {
  margin-block-start: 0;
}

.header-nav {
  background-color: var(--pj-header-bg);
}

.header-nav .primary-nav__menu-link {
  color: #fff;
}

body:not(.is-always-mobile-nav) .header-nav .primary-nav__menu--level-1 > li .icon--menu-toggle {
  color: #fff;
  background-color: var(--pj-header-bg);
}

.mobile-nav-button {
  background-color: #fff;
}

#block-paperjewels-subtheme-searchform {
  position: absolute;
  bottom: -26px;
  right: 0;
  z-index: 502;
}

#block-paperjewels-subtheme-searchform .form-search {
  box-shadow: inset 2px 2px 2px rgba(0, 0, 0, 0.07);
  background-color: #eeeeee;
  border: 0;
  font-family: "Courier New", "DejaVu Sans Mono", monospace, sans-serif;
  font-size: 13px;
  line-height: 20px;
  margin: 0;
  min-height: auto;
  padding: .5em;
  position: relative;
  top: 2px;
  width: 260px;
}

#block-paperjewels-subtheme-searchform input[type="submit"] {
  position: relative;
  top: 4px;
  width: 36px;
  height: 33px;
  padding: 0;
  border: 0;
  background: url("../images/search-icon.png") no-repeat center / contain;
  text-indent: -9999px;
  overflow: hidden;
  cursor: pointer;
}

@media (min-width: 43.75rem) {
  #block-paperjewels-subtheme-searchform {
    bottom: auto;
    top: 0;
  }
}

@media (min-width: 75rem) {
  body:not(.is-always-mobile-nav) .header-nav .primary-nav__menu--level-2 {
    background-color: var(--pj-header-bg);
  }

  /* Match the header so Olivero's blue doesn't show. */
  .site-header__initial,
  .sticky-header-toggle {
    background-color: var(--pj-header-bg);
  }

  #block-paperjewels-subtheme-searchform {
    top: -30px;
  }

  /* Disable Olivero's sticky desktop header. Olivero's JS still adds
     .is-fixed to .site-header__fixable on scroll; neutralize everything
     that class does so the header just scrolls away with the page and the
     sticky toggle button never appears. */
  body:not(.is-always-mobile-nav) .site-header__fixable.is-fixed {
    position: static;
    pointer-events: auto;
  }

  /* Selector must match Olivero's specificity (incl. :not(.is-expanded)),
     or its translateX(-101%) wins and the header slides off to the left.
     Chrome's IntersectionObserver reports a ratio just under 1 on load,
     so .is-fixed gets added immediately there (Firefox reports 1). */
  body:not(.is-always-mobile-nav) .site-header__fixable.is-fixed .site-header__inner,
  body:not(.is-always-mobile-nav) .site-header__fixable.is-fixed:not(.is-expanded) .site-header__inner,
  [dir="rtl"] body:not(.is-always-mobile-nav) .site-header__fixable.is-fixed:not(.is-expanded) .site-header__inner {
    transform: none;
    opacity: 1;
    box-shadow: none;
  }

  body:not(.is-always-mobile-nav) .is-fixed .sticky-header-toggle {
    visibility: hidden;
  }
}


/* ==========================================================================
   4. Node and body content
   ========================================================================== */

.node__content .field:not(:last-child) {
  margin-block-end: 15px;
}

.node__content .field--label-inline .field__label,
.node__content .field--label-inline .field__items {
  float: none;
  display: inline;
  padding-inline-end: 0;
}

.node__content .field--label-inline.clearfix::after {
  display: none;
}

.text-content table td,
.text-content table th {
  border-width: 0;
}

.field--name-body .box {
  border: 1px solid #c0c0c0;
  padding: 15px;
  margin-bottom: 15px;
}

.page-node-type-video .field--name-body iframe {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

@media (max-width: 43.75rem) {
  .text-content table td {
    display: block;
    padding: 0;
    width: auto;
  }
}

@media (min-width: 75rem) {
  .node__content > .field,
  .node__content > .field .field__item {
    display: inline;
  }

  .node__content .field__item {
    margin-right: 15px;
  }

  .node__content > .field.field--type-image {
    margin-right: 0;
    margin-bottom: 25px;
  }

  .node__content > .field.field--type-image img {
    margin-bottom: 25px;
  }

  .node__content > .field.field--name-body {
    display: block;
    margin-top: 25px;
  }

  .page-node-type-video .field--name-body iframe {
    border: 10px solid #000;
  }
}


/* ==========================================================================
   5. Legacy D7 markup
   ========================================================================== */

/* Old body text wraps passages in <font size="-1"> etc.; don't shrink them. */
font[size^="-"] {
  font-size: inherit;
}

/*
 * Legacy D7 <img align="*"> is rewritten to these classes by
 * paperjewels_subtheme_preprocess_field() so old body-field markup keeps
 * its original float/vertical-align behavior.
 */
img.img-align-left {
  float: left;
  margin: 0 15px 15px 0;
}

img.img-align-right {
  float: right;
  margin: 0 0 15px 15px;
}

img.img-align-center {
  display: block;
  float: none;
  margin-left: auto;
  margin-right: auto;
}

img.img-align-top,
img.img-align-texttop {
  vertical-align: top;
}

img.img-align-middle,
img.img-align-absmiddle {
  vertical-align: middle;
}

img.img-align-bottom,
img.img-align-baseline {
  vertical-align: bottom;
}


/* ==========================================================================
   6. Views
   ========================================================================== */

.view,
.view-content {
  gap: var(--sp1);
}

.views-element-container.views-result-empty {
  display: none;
}

.views-view-grid .views-view-grid__item a {
  display: inline-block;
}

.views-field-field-slide-image + .views-field-name {
  margin-top: 15px;
}

.view-slide-image img {
  margin: auto;
}

/* Olivero lays out views as a grid; this one needs normal block flow. */
.view-daily-raj-postcard-categories.view-display-id-page,
.view-daily-raj-postcard-categories.view-display-id-page > .view-content {
  display: block;
}

.vvj-basic-carousel .view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pj--views-list .teaser__content {
  position: relative;
  display: flex;
  align-items: center;
}

.pj--views-list .teaser__content .field--type-image {
  min-width: 120px;
}

.pj--views-list .text-content p:first-child,
.pj--views-list .text-content p:last-child {
  margin-block-end: 0;
  margin-block-start: 0;
}

@media (min-width: 75rem) {
  /* all_terms: exposed name filter sits top-right, above the results. */
  .view-id-all_terms {
    position: relative;
  }

  .view-id-all_terms .view-filters {
    position: absolute;
    top: -40px;
    right: 0;
  }

  .view-id-all_terms .view-filters .views-exposed-form,
  .view-id-all_terms .view-filters .form-item-name {
    display: flex;
    align-items: center;
    margin-right: 10px;
  }

  .view-id-all_terms .view-filters .form-item-name label {
    margin-right: 10px;
  }

  .view-id-all_terms .view-filters .form-item-name input {
    min-height: 2rem;
  }

  .view-id-all_terms .view-filters .views-exposed-form .form-actions {
    margin-top: 8px;
  }

  .view-id-all_terms .view-filters .views-exposed-form .form-submit {
    height: 2rem;
  }

  /* Blog and term listing teasers: "Read more" pinned bottom-right. */
  .view-blog .teaser,
  .view-taxonomy-term .teaser {
    padding-bottom: 20px;
  }

  .view-blog .teaser__content,
  .view-taxonomy-term .teaser__content {
    padding-bottom: 10px;
  }

  .view-blog .teaser__content .pj-read-more,
  .view-taxonomy-term .teaser__content .pj-read-more {
    position: absolute;
    bottom: 0;
    right: 0;
  }
}


/* ==========================================================================
   7. Utilities
   ========================================================================== */

/* Kept last: at tablet width and up, its img rule must win over the
   equal-specificity img rules in sections 5 and 6. */
.text-align-center {
  text-align: center;
}

@media (min-width: 43.75rem) {
  .text-align-center img {
    margin: 0 20px;
    display: inline-block;
    vertical-align: middle;
  }
}
