/*
 * AlvaradoCSS — article, biography, title-banner, and 404 components
 *
 * This root-level stylesheet is loaded through _quarto.yml. Keeping it at the
 * project root preserves existing relative paths to images and pattern assets.
 */

/* =============================================================================
 * Biography introduction
 * ========================================================================== */

/*
 * Pair the opening biography with the portrait on screens that provide enough
 * horizontal room. The copy receives the larger share because it contains the
 * page's primary orientation and CV link.
 */
.bio-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.85fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 4.5rem);
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.bio-intro h1 {
  margin-top: 0;
}

/*
 * Keep the portrait responsive and centered inside its grid column. Height
 * remains automatic so the source aspect ratio is never warped.
 */
.bio-image {
  display: block;
  width: min(100%, 400px);
  height: auto;
  margin-right: auto;
  margin-left: auto;
}

/*
 * Restore a natural reading order on tablets and phones. Copy remains first in
 * the document, so the stacked layout requires no visual reordering.
 */
@media (max-width: 760px) {
  .bio-intro {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
}

/* ==========================================================================
   CUSTOM 404 PAGE
   ========================================================================== */

/*
  The 404 page is intentionally simple. It gives the status code strong visual
  prominence while keeping the recovery actions easy to find and keyboard
  accessible.
*/

.not-found-page {
  max-width: 52rem;
  margin: 4rem auto;
  padding: 3rem;
  text-align: center;
  border: 1px solid var(--color-dark-border-14);
  border-radius: 1.25rem;
  background: var(--color-white);
  box-shadow: 0 0.75rem 2rem var(--color-dark-shadow-08);
}

.not-found-code {
  margin: 0;
  font-family: Sen, sans-serif;
  font-size: clamp(5rem, 18vw, 10rem);
  font-weight: 800;
  line-height: 0.9;
  color: var(--color-brand-teal);
}

.not-found-page h1 {
  margin-top: 1.25rem;
}

.not-found-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 2rem;
}

/*
 * Quarto wraps each authored button in a paragraph. Let the action container's
 * gap control all spacing instead of combining it with default paragraph
 * margins.
 */
.not-found-actions > p {
  margin: 0;
}

@media (max-width: 600px) {
  .not-found-page {
    margin: 2rem auto;
    padding: 2rem 1.25rem;
  }

  .not-found-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .not-found-actions .btn {
    width: 100%;
  }
}

/* =============================================================================
 * Quarto title-banner knowledge-graph texture
 * ========================================================================== */

/*
 * Preserve page titles as Quarto metadata while hiding only the visible title
 * text automatically generated by Quarto.
 *
 * This selector works whether Quarto places the title inside a decorative
 * title banner or inside a standard title block. Manually authored headings
 * outside `.quarto-title-block` remain visible.
 */
.quarto-title-block .title {
  display: none;
}

/*
 * Standard-page banners are intentionally decorative. Hide every textual
 * title-block child on pages without post categories so only the background
 * texture remains visible. Categorized posts are restored in the scoped rules
 * below and continue to display their complete editorial metadata.
 */
body:not(:has(.quarto-title-block .quarto-categories)) .quarto-title-block .quarto-title-banner .quarto-title,
body:not(:has(.quarto-title-block .quarto-categories)) .quarto-title-block .quarto-title-banner .quarto-title-meta {
  display: none;
}

/*
 * Apply a real SVG network pattern over the teal biography banner.
 *
 * The SVG is stored as a normal project asset rather than a data URI. This
 * makes the pattern easier to inspect, edit, and verify in browser developer
 * tools. The selector matches Quarto's generated banner selector exactly.
 */
.quarto-title-block .quarto-title-banner {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background-color: var(--color-brand-teal);
  background-image: linear-gradient(
    135deg,
    #e7f1f3 0%,
    var(--color-brand-teal-light) 55%,
    var(--color-brand-teal-dark) 100%
  );
}

/*
 * Standard pages retain the signature knowledge graph as a separate, quieter
 * layer. A wider tile reduces repetition, while the lateral mask lets the
 * decoration enter and leave the band without hard visual edges.
 */
body:not(:has(.quarto-title-block .quarto-categories)) .quarto-title-block .quarto-title-banner::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  pointer-events: none;
  background-image: url("images/patterns/network-pattern.svg");
  background-position: center;
  background-repeat: repeat-x;
  background-size: 430px 251px;
  opacity: 0.52;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 10%,
    black 90%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 10%,
    black 90%,
    transparent 100%
  );
}

/*
 * Use a smaller tile on narrow screens, where the banner grows taller as its
 * text wraps.
 */
@media (max-width: 700px) {
  body:not(:has(.quarto-title-block .quarto-categories)) .quarto-title-block .quarto-title-banner::before {
    background-size: 320px 187px;
    opacity: 0.46;
  }
}

/* =============================================================================
 * Individual blog post title banners
 * ========================================================================== */

/*
 * Quarto does not add a dedicated body class to every individual blog post.
 * The post title block does, however, contain the generated category list.
 * Using `:has()` here confines the editorial treatment to pages whose title
 * block contains those blog categories, leaving all other website banners
 * governed exclusively by the established rules above.
 */
body:has(.quarto-title-block .quarto-categories) .quarto-title-block .quarto-title-banner {
  position: relative;
  isolation: isolate;

  /*
   * Let the banner height follow the title, subtitle, description, categories,
   * and metadata instead of reserving an oversized fixed-height hero area.
   * No transforms are applied, so the authored content keeps its natural
   * vertical position within Quarto's title-block layout.
   */
  min-height: 0;
  padding-top: clamp(3.5rem, 7vw, 6rem);
  padding-bottom: clamp(3.25rem, 6vw, 5.25rem);
  overflow: hidden;

  /*
   * Retain the website's teal identity while giving the title a calmer field.
   * The network itself is moved to the dedicated pseudo-element below so its
   * position and fading can be controlled without affecting this base surface.
   */
  background-color: var(--color-brand-teal);
  background-image:
    linear-gradient(
      135deg,
      #ffffff 0%,
      #e7f1f3 50%,
      #a3ced2 100%
      /*var(--color-brand-teal-light) 100%*/
      /*var(--color-brand-teal-dark) 100%*/
    );
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

/*
 * Draw the knowledge-graph texture lower in the banner and fade it in only
 * beneath the principal title region. The mask prevents dense lines and nodes
 * from competing with the article typography while preserving the established
 * network motif near the lower portion of the hero.
 */
body:has(.quarto-title-block .quarto-categories) .quarto-title-block .quarto-title-banner::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  pointer-events: none;
  background-image: url("images/patterns/network-pattern.svg");
  background-position: center calc(100% + 3rem);
  background-repeat: repeat-x;
  background-size: 420px 245px;
  opacity: 0.72;
  -webkit-mask-image:
    linear-gradient(
      to bottom,
      var(--color-transparent) 0%,
      var(--color-transparent) 30%,
      var(--color-mask-black-18) 52%,
      var(--color-black) 100%
    );
  mask-image:
    linear-gradient(
      to bottom,
      var(--color-transparent) 0%,
      var(--color-transparent) 30%,
      var(--color-mask-black-18) 52%,
      var(--color-black) 100%
    );
}

/*
 * Keep every generated title-block element above the decorative network layer.
 * This includes the title, subtitle, description, categories, and metadata.
 */
body:has(.quarto-title-block .quarto-categories) .quarto-title-block .quarto-title-banner > * {
  position: relative;
  z-index: 1;
}

/*
 * The site-wide rule above hides Quarto's generated page titles because the
 * standard pages use manually authored headings. Individual posts are the sole
 * exception: their generated title is the primary editorial headline and must
 * therefore be restored.
 */
body:has(.quarto-title-block .quarto-categories) .quarto-title-block .title {
  display: block;
  max-width: 19ch;
  margin-bottom: clamp(1.5rem, 2.5vw, 2rem);
  font-size: clamp(2.75rem, 6.5vw, 5.75rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.98;
  text-wrap: balance;
}

/*
 * Preserve the established visual scale after article body headings were
 * moved one semantic level below the generated article title.
 *
 * Quarto now renders major article sections as `.level2 > h2` and their
 * subsections as `.level3 > h3`. These rules reproduce Bootstrap's former H1
 * and H2 sizes without changing the improved document hierarchy. Scoping the
 * selectors through a categorized title block limits this adjustment to blog
 * posts and leaves standard pages and card headings untouched.
 */
body:has(.quarto-title-block .quarto-categories) #quarto-document-content > .level2 > h2 {
  font-size: calc(1.375rem + 1.5vw);
}

body:has(.quarto-title-block .quarto-categories) #quarto-document-content .level3 > h3 {
  font-size: calc(1.325rem + 0.9vw);
}

/*
 * Bootstrap caps its responsive H1 and H2 scales at this breakpoint. Matching
 * those caps prevents headings from continuing to grow on wide screens.
 */
@media (min-width: 1200px) {
  body:has(.quarto-title-block .quarto-categories) #quarto-document-content > .level2 > h2 {
    font-size: 2.5rem;
  }

  body:has(.quarto-title-block .quarto-categories) #quarto-document-content .level3 > h3 {
    font-size: 2rem;
  }
}

/*
 * Preserve a clear secondary level for subtitles. They remain substantial
 * enough to orient the reader but no longer rival the main article title.
 */
body:has(.quarto-title-block .quarto-categories) .quarto-title-block .subtitle {
  display: none;
}

/*
 * Treat the description as supporting editorial copy rather than another
 * headline. The restrained width and scale improve scanning on wide screens.
 */
body:has(.quarto-title-block .quarto-categories) .quarto-title-block .description {
  max-width: 46rem;
  margin-top: 0;
  margin-bottom: 1.1rem;
  font-size: clamp(1rem, 1.7vw, 1.18rem);
  font-weight: 400;
  line-height: 1.55;
  opacity: 0.84;
}

/*
 * Render the editorial typography in black while leaving the category
 * pills as the site's pink accent.
 */
body:has(.quarto-title-block .quarto-categories) .quarto-title-block .title,
body:has(.quarto-title-block .quarto-categories) .quarto-title-block .subtitle,
body:has(.quarto-title-block .quarto-categories) .quarto-title-block .description {
  color: var(--color-black);
}

/*
 * Reduce category emphasis while retaining their function as recognizable,
 * accessible links. The compact proportions keep them subordinate to the
 * title, subtitle, and description hierarchy.
 */
body:has(.quarto-title-block .quarto-categories) .quarto-title-block .quarto-categories {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.9rem;
}

body:has(.quarto-title-block .quarto-categories) .quarto-title-block .quarto-category {
  flex: 0 0 auto;
  width: auto;
  max-width: 100%;
  padding: 0.22rem 0.62rem;
  border: 1px solid var(--color-brand-teal-light);
  border-radius: 999px;
  background: var(--color-white);
  color: var(--color-brand-teal-light);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  line-height: 1.35;
  opacity: 1;
}

/*
 * Keep the generated author/date area visually quiet so it supports rather
 * than competes with the editorial headline. This does not alter its content
 * or document order.
 */
body:has(.quarto-title-block .quarto-categories) .quarto-title-block .quarto-title-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem clamp(1.5rem, 4vw, 3rem);
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  font-size: 0.98rem;
  line-height: 1.45;
  opacity: 0.88;
}

body:has(.quarto-title-block .quarto-categories) .quarto-title-block .quarto-title-meta > div:first-child {
  grid-row: 1 / span 2;
}

body:has(.quarto-title-block .quarto-categories) .quarto-title-block .quarto-title-meta-heading {
  margin-top: 0;
  font-size: 1em;
  font-weight: 700;
  letter-spacing: 0.04em;
}

body:has(.quarto-title-block .quarto-categories) .quarto-title-block .quarto-title-meta-contents p {
  margin-bottom: 0;
}

/*
 * Narrow screens need slightly less vertical space and a smaller network tile.
 * The hero remains content-driven, with no fixed height or artificial divider.
 */
@media (max-width: 700px) {
  body:has(.quarto-title-block .quarto-categories) .quarto-title-block .quarto-title-banner {
    padding-top: 3rem;
    padding-bottom: 2.75rem;
  }

  body:has(.quarto-title-block .quarto-categories) .quarto-title-block .quarto-title-banner::before {
    background-position: center calc(100% + 2rem);
    background-size: 300px 175px;
  }

  body:has(.quarto-title-block .quarto-categories) .quarto-title-block .title {
    max-width: none;
    font-size: clamp(2.35rem, 11vw, 3.75rem);
    line-height: 1.02;
  }

  body:has(.quarto-title-block .quarto-categories) .quarto-title-block .quarto-title-meta {
    grid-template-columns: 1fr;
  }

  body:has(.quarto-title-block .quarto-categories) .quarto-title-block .quarto-title-meta > div:first-child {
    grid-row: auto;
  }
}

/* =============================================================================
 * Biography block quotes
 * ========================================================================== */

/*
 * Allow individual block quotes to use different accent colors while keeping
 * Quarto's default typography unchanged.
 */

.blockquote-burgundy blockquote {
  border-left: 4px solid var(--color-brand-burgundy);
}

/*
 * Reusable brand-colored Font Awesome icons.
 */
.blockquote-teal blockquote {
  border-left: 4px solid var(--color-brand-teal);
}

.icon-teal-dark {
  color: var(--color-brand-teal-dark);
}

.icon-burgundy-dark {
  color: var(--color-brand-burgundy-dark);
}

.icon-pink {
  color: var(--color-brand-pink);
}

.icon-gold {
  color: var(--color-brand-gold);
}

.photo-attribution {
  font-variant: small-caps;
  font-size: 0.8em;
}

/* =============================================================================
 * Metadata-driven Blog citations
 * ========================================================================== */

/*
 * The citation shortcode emits the same semantic structure on every post.
 * A quiet surface and restrained border distinguish this reusable utility
 * from the article argument without competing with headings or callouts.
 */
.post-citation {
  margin-block: 2rem;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid rgb(21 124 135 / 28%);
  border-left: 0.3rem solid var(--color-brand-teal);
  border-radius: 0.35rem;
  background: rgb(21 124 135 / 5%);
}

/*
 * Quarto normally adds anchor affordances to authored headings. The shortcode
 * produces raw semantic HTML, so these margins establish the same visual
 * rhythm explicitly.
 */
.post-citation > h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.post-citation-controls {
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.post-citation-enhanced .post-citation-controls {
  display: flex;
}

.post-citation-toggle,
.post-citation-copy {
  border: 1px solid var(--color-brand-teal);
  border-radius: 0.35rem;
  background: var(--color-white);
  color: var(--color-brand-teal-dark);
  font: inherit;
  font-weight: 700;
}

.post-citation-toggle {
  padding: 0.4rem 0.8rem;
}

.post-citation-toggle.is-active,
.post-citation-toggle:hover,
.post-citation-toggle:focus-visible {
  background: var(--color-brand-teal-dark);
  color: var(--color-white);
}

.post-citation-copy {
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
}

.post-citation-copy:hover,
.post-citation-copy:focus-visible {
  border-color: var(--color-brand-burgundy);
  background: var(--color-brand-burgundy);
  color: var(--color-white);
}

/*
 * Each style is a separate entry so readers can identify and copy precisely
 * one reference. Long canonical URLs may wrap at any point on narrow screens
 * instead of forcing horizontal page scrolling.
 */
.post-citation-entry + .post-citation-entry {
  margin-top: 1.15rem;
  padding-top: 1.15rem;
  border-top: 1px solid rgb(21 124 135 / 20%);
}

.post-citation-enhanced .post-citation-entry + .post-citation-entry {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.post-citation-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
}

.post-citation-style {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  color: var(--color-brand-teal-dark);
}

.post-citation-reference {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.65;
}

/* =============================================================================
 * Discreet Blog sharing
 * ========================================================================== */

/*
 * Keep sharing available without turning it into another callout. The compact
 * text controls use the site's existing colors rather than platform branding.
 */
.post-share {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  margin-block: 1.25rem 1.75rem;
  font-size: 0.82rem;
  color: rgb(0 0 0 / 70%);
}

.post-share-label {
  font-weight: 700;
}

.post-share-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem 0.65rem;
}

.post-share-actions a,
.post-share-actions button {
  padding: 0;
  border: 0;
  border-bottom: 1px solid rgb(21 124 135 / 38%);
  border-radius: 0;
  background: transparent;
  color: var(--color-brand-teal-dark);
  font: inherit;
  line-height: 1.35;
  text-decoration: none;
}

.post-share-actions a:hover,
.post-share-actions a:focus-visible,
.post-share-actions button:hover,
.post-share-actions button:focus-visible {
  border-bottom-color: currentcolor;
  color: var(--color-brand-burgundy);
}

/* =============================================================================
 * Floating Blog contact vignette
 * ========================================================================== */

.post-contact-vignette {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 1030;

  display: grid;
  gap: 0.08rem;
  width: min(19rem, calc(100vw - 2rem));
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--color-teal-border);
  border-left: 0.28rem solid var(--color-brand-burgundy);
  border-radius: 0.65rem;
  background: rgb(255 255 255 / 96%);
  box-shadow: 0 0.75rem 2rem var(--color-burgundy-shadow-12);
  color: var(--color-black);
  font-size: 0.82rem;
  line-height: 1.35;
}

.post-contact-vignette strong {
  color: var(--color-brand-burgundy);
  font-family: Sen, sans-serif;
  font-size: 0.9rem;
}

.post-contact-vignette em {
  color: rgb(0 0 0 / 68%);
  font-size: 0.76rem;
}

.post-contact-vignette .post-contact-email {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  width: fit-content;
  padding: 0.38rem 0.5rem;
  border: 0;
  background: rgb(21 124 135 / 7%);
  color: var(--color-brand-teal-dark);
  font: inherit;
  cursor: pointer;
}

.post-contact-vignette .post-contact-email:hover,
.post-contact-vignette .post-contact-email:focus-visible {
  background: rgb(21 124 135 / 13%);
  color: var(--color-brand-pink);
}

.post-contact-confirmation {
  min-width: 3.2em;
  color: var(--color-brand-burgundy);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@media (max-width: 700px) {
  body:has(.post-contact-vignette) {
    padding-bottom: calc(8rem + env(safe-area-inset-bottom));
  }

  .post-contact-vignette {
    right: 0.75rem;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    left: 0.75rem;
    width: auto;
    padding: 0.7rem 0.85rem;
  }
}
