/* Plain text links use underlines; dedicated buttons keep their own material. */
:where(a[href], .rw-text-button, .path-chronology h3 > button) {
  --link-rgb: var(--ph-area-rgb, var(--accent-rgb, 195, 201, 205));
  --link-color: var(--ph-area-color, var(--accent, #c3c9cd));
}

/* Buttons and category tiles already have their own complete glass surfaces. */
a[href]:not(:where(.button, .brand, .skip-link, .project-link, .ph-area-card a, .project-card a, .next-work-links > a, .project-try, .ph-lab-action, .ph-area-action, .search-result, [data-area])),
.rw-text-button,
.path-chronology h3 > button {
  border-radius: 0;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .25em;
  text-shadow: none;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: color .2s ease;
}

a[href]:not(:where(.button, .brand, .skip-link, .project-link, .ph-area-card a, .project-card a, .next-work-links > a, .project-try, .ph-lab-action, .ph-area-action, .search-result, [data-area])):is(:hover, :focus-visible),
.rw-text-button:is(:hover, :focus-visible),
.path-chronology h3 > button:is(:hover, :focus-visible) {
  color: var(--link-color);
  color: color-mix(in srgb, var(--link-color) 82%, white);
  background-color: transparent;
  box-shadow: none;
  text-shadow: none;
}

a[href]:not(:where(.button, .brand, .skip-link, .project-link, .ph-area-card a, .project-card a, .next-work-links > a, .project-try, .ph-lab-action, .ph-area-action, .search-result, [data-area])):active,
.rw-text-button:active,
.path-chronology h3 > button:active {
  background-color: transparent;
  box-shadow: none;
  text-shadow: none;
}

/* Keep inline references recognisable when no pointer is present. */
.contact-form-note a,
.academic-source a,
.academic-document-note a,
.case-cover figcaption a { color: var(--accent); }

/* Rounded keyboard focus surrounds the target instead of underlining it. */
a[href]:focus-visible,
.rw-text-button:focus-visible,
.path-chronology h3 > button:focus-visible {
  outline: 2px solid var(--link-color);
  outline-offset: 4px;
}

/* Selection is expressed by the whole surface, matching the glass cards. */
.project-demo-tabs > button,
.lab-tabs button,
.ad-demo .ad-config-button,
.ad-demo .ad-stage-button {
  transition: background-color .22s ease, border-color .22s ease, box-shadow .22s ease, color .22s ease;
}
.project-demo-tabs > button[aria-selected="true"],
.lab-tabs button[aria-selected="true"],
.ad-demo .ad-config-button[aria-pressed="true"],
.ad-demo .ad-stage-button[aria-pressed="true"] {
  background: linear-gradient(140deg, rgba(255, 255, 255, .045), rgba(var(--accent-rgb), .08)), rgba(var(--accent-rgb), .07);
  border-color: rgba(var(--accent-rgb), .55);
  box-shadow: 0 0 17px rgba(var(--accent-rgb), .075);
}

html[data-motion="paused"] :is(a[href], .rw-text-button, .path-chronology h3 > button, .project-demo-tabs > button, .lab-tabs button, .ad-config-button, .ad-stage-button) { transition: none; }

@media (prefers-reduced-motion: reduce) {
  :is(a[href], .rw-text-button, .path-chronology h3 > button, .project-demo-tabs > button, .lab-tabs button, .ad-config-button, .ad-stage-button) { transition: none; }
}

@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  a[href]:not(:where(.button, .brand, .skip-link, .project-link, .ph-area-card a, .project-card a, .next-work-links > a, .project-try, .ph-lab-action, .ph-area-action, .search-result, [data-area])):is(:hover, :focus-visible, :active),
  .rw-text-button:is(:hover, :focus-visible, :active),
  .path-chronology h3 > button:is(:hover, :focus-visible, :active) {
    background: transparent;
    box-shadow: none;
    text-shadow: none;
  }
  .project-demo-tabs > button[aria-selected="true"],
  .lab-tabs button[aria-selected="true"],
  .ad-demo .ad-config-button[aria-pressed="true"],
  .ad-demo .ad-stage-button[aria-pressed="true"] {
    background: var(--panel-solid, #242c31);
    border-color: var(--accent);
    box-shadow: none;
  }
}

@media (forced-colors: active) {
  a[href]:not(:where(.button, .brand, .skip-link, .project-link, .ph-area-card a, .project-card a, .next-work-links > a, .project-try, .ph-lab-action, .ph-area-action, .search-result, [data-area])):is(:hover, :focus-visible, :active),
  .rw-text-button:is(:hover, :focus-visible, :active),
  .path-chronology h3 > button:is(:hover, :focus-visible, :active) {
    color: LinkText;
    background: Canvas;
    box-shadow: none;
    text-shadow: none;
  }
  a[href]:focus-visible,
  .rw-text-button:focus-visible,
  .path-chronology h3 > button:focus-visible { outline-color: Highlight; }
  .project-demo-tabs > button[aria-selected="true"],
  .lab-tabs button[aria-selected="true"],
  .ad-demo .ad-config-button[aria-pressed="true"],
  .ad-demo .ad-stage-button[aria-pressed="true"] {
    color: HighlightText;
    background: Highlight;
    border-color: Highlight;
    box-shadow: none;
  }
}

/* Every call to action shares the Portfolio material, including case studies,
   contact/confirmation pages, the tour and workflow actions. */
:root :is(.button, .path-filter-row > .path-filter, .rw-panel-actions > .rw-action, .mw-actions > :is(.mw-organise, .mw-reset)) {
  --harmonized-rgb: var(--path-rgb, var(--accent-rgb));
  --harmonized-accent: var(--path-color, var(--accent));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(var(--harmonized-rgb), .28);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(255,255,255,.065), rgba(var(--harmonized-rgb),.04)), rgba(29,36,40,.38);
  color: var(--text);
  font-family: var(--sans);
  font-size: .875rem;
  font-weight: 300;
  line-height: 1.5;
  letter-spacing: 0;
  text-decoration: none;
  text-shadow: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 4px 16px rgba(4,8,10,.12);
  -webkit-backdrop-filter: blur(12px) saturate(110%);
  backdrop-filter: blur(12px) saturate(110%);
  transform: none;
  filter: none;
  transition: border-color .2s ease, background-color .2s ease;
}
:root :is(.button, .path-filter-row > .path-filter, .rw-panel-actions > .rw-action, .mw-actions > :is(.mw-organise, .mw-reset)):is(:hover, :active, :focus-visible) {
  color: var(--text);
  border-color: rgba(var(--harmonized-rgb), .6);
  background-color: rgba(var(--harmonized-rgb), .09);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 4px 16px rgba(4,8,10,.12);
  text-shadow: none;
  transform: none;
  filter: none;
}
:root :is(.rw-panel-actions > .rw-action, .mw-actions > :is(.mw-organise, .mw-reset)):disabled {
  color: var(--subtle);
  border-color: var(--line);
  background: rgba(var(--panel-rgb), .35);
  box-shadow: none;
  opacity: .65;
  cursor: default;
}
:root .path-filter-row > .path-filter[aria-pressed="true"] {
  color: var(--harmonized-accent);
  border-color: rgba(var(--harmonized-rgb), .65);
  background: linear-gradient(135deg, rgba(var(--harmonized-rgb),.16), rgba(var(--harmonized-rgb),.055)), rgba(29,36,40,.45);
}
:root :is(.button, .path-filter-row > .path-filter, .rw-panel-actions > .rw-action, .mw-actions > :is(.mw-organise, .mw-reset)):focus-visible {
  outline: 2px solid var(--harmonized-accent);
  outline-offset: 4px;
}
.contact-section-social { gap: 10px; }
@media (prefers-reduced-motion: reduce) {
  :root :is(.button, .path-filter-row > .path-filter, .rw-panel-actions > .rw-action, .mw-actions > :is(.mw-organise, .mw-reset)) { transition: none; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  :root :is(.button, .path-filter-row > .path-filter, .rw-panel-actions > .rw-action, .mw-actions > :is(.mw-organise, .mw-reset)) {
    background: var(--panel-solid);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
  }
}
@media (forced-colors: active) {
  :root :is(.button, .path-filter-row > .path-filter, .rw-panel-actions > .rw-action, .mw-actions > :is(.mw-organise, .mw-reset)) {
    background: Canvas;
    color: ButtonText;
    border-color: ButtonText;
    box-shadow: none;
  }
  :root :is(.rw-panel-actions > .rw-action, .mw-actions > :is(.mw-organise, .mw-reset)):disabled {
    color: GrayText;
    border-color: GrayText;
    background: Canvas;
  }
  :root .path-filter-row > .path-filter[aria-pressed="true"] { color: Highlight; border-color: Highlight; }
}

/* Research references are recognisable text links, with no luminous surface. */
:root .portfolio-research a.text-link,
:root .portfolio-research a.text-link:is(:hover, :focus-visible, :active) {
  background: none;
  border-radius: 0;
  box-shadow: none;
  text-shadow: none;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .25em;
  transition: color .2s ease;
}
:root .portfolio-research a.text-link:hover { color: var(--accent); }

/* About shortcuts and all timeline references use underlined text links. */
:root :is(.profile-actions > a.text-link, .path-section .path-links > a, .path-section a.path-timeline-return),
:root :is(.profile-actions > a.text-link, .path-section .path-links > a, .path-section a.path-timeline-return):is(:hover, :focus-visible, :active) {
  background: none;
  border-radius: 0;
  box-shadow: none;
  text-shadow: none;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .25em;
  transition: color .2s ease;
}

/* Transparent glass capsules for the primary navigation and social profiles. */
:root :is(.desktop-nav, .mobile-nav, .contact-section-social) > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 42px;
  padding: 9px 17px;
  border: 1px solid rgba(230,237,240,.17);
  border-radius: 999px;
  background: linear-gradient(155deg, rgba(255,255,255,.055), rgba(255,255,255,.008) 58%, rgba(195,210,220,.025));
  color: var(--text);
  font-family: var(--sans);
  font-size: .875rem;
  font-weight: 300;
  line-height: 1.5;
  letter-spacing: 0;
  text-decoration: none;
  text-shadow: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), inset 0 -1px 0 rgba(255,255,255,.025), 0 3px 10px rgba(4,8,10,.06);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
  backdrop-filter: blur(14px) saturate(115%);
  transform: none;
  filter: none;
  transition: border-color .2s ease, background-color .2s ease;
}
:root :is(.desktop-nav, .mobile-nav, .contact-section-social) > a:is(:hover, :active, :focus-visible) {
  background-color: rgba(255,255,255,.035);
  border-color: rgba(230,237,240,.35);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), inset 0 -1px 0 rgba(255,255,255,.025), 0 3px 10px rgba(4,8,10,.06);
  text-shadow: none;
  transform: none;
  filter: none;
}
:root :is(.desktop-nav, .mobile-nav) > a[aria-current="page"] {
  background-color: rgba(255,255,255,.055);
  border-color: rgba(230,237,240,.4);
  color: var(--text);
}
:root :is(.desktop-nav, .mobile-nav, .contact-section-social) > a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
@media (max-width: 680px) {
  :root .mobile-nav > a { display: flex; justify-content: flex-start; padding-inline: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  :root :is(.desktop-nav, .mobile-nav, .contact-section-social) > a { transition: none; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  :root :is(.desktop-nav, .mobile-nav, .contact-section-social) > a { background: var(--panel-solid); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; }
}
@media (forced-colors: active) {
  :root :is(.desktop-nav, .mobile-nav, .contact-section-social) > a { background: Canvas; color: LinkText; border-color: LinkText; box-shadow: none; }
  :root :is(.desktop-nav, .mobile-nav) > a[aria-current="page"] { color: Highlight; border-color: Highlight; }
}
html[data-motion="paused"] :is(.desktop-nav, .mobile-nav, .contact-section-social) > a { transition: none; }

/* One solid navigation disclosure at every screen size. Stretching its
   anchor to the header keeps the panel 12px below the header's border. */
.site-header .header-actions { margin-left: auto; gap: 14px; align-self: stretch; align-items: center; }
.navigation-dropdown { position: relative; display: flex; align-items: center; align-self: stretch; }
.navigation-dropdown .navigation-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 10px;
  border: 1px solid rgba(var(--accent-rgb), .32);
  border-radius: 13px;
  background: var(--panel-solid);
  color: var(--text);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  transition: border-color .2s ease;
}
.navigation-dropdown .navigation-toggle:is(:hover, [aria-expanded="true"]) { border-color: rgba(var(--accent-rgb), .7); }
.navigation-toggle .icon { width: 22px; height: 22px; }
:root .navigation-dropdown-panel {
  display: flex;
  position: absolute;
  top: calc(100% + 13px);
  right: 0;
  left: auto;
  z-index: 30;
  width: 200px;
  max-width: calc(100vw - 40px);
  padding: 4px 14px;
  flex-direction: column;
  gap: 0;
  border: 1px solid rgba(var(--accent-rgb), .32);
  border-radius: 13px;
  background: var(--panel-solid);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
:root .navigation-dropdown-panel > a,
:root .navigation-dropdown-panel > a:is(:hover, :focus-visible, :active) {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 48px;
  padding: 12px 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  color: var(--text);
  font: 300 .875rem/1.5 var(--sans);
  text-shadow: none;
  text-decoration: none;
}
:root .navigation-dropdown-panel > a + a,
:root .navigation-dropdown-panel > a + a:is(:hover, :focus-visible, :active) { border-top: 1px solid var(--line); }
:root .navigation-dropdown-panel > a:is(:hover, :focus-visible),
:root .navigation-dropdown-panel > a[aria-current="page"] { color: var(--accent); }
.navigation-dropdown .navigation-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
:root .navigation-dropdown-panel > a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
@media (max-width: 680px) {
  .site-header .header-actions { gap: 10px; }
}
@media (max-width: 380px) {
  .site-header .brand { font-size: .9rem; gap: 6px; }
  .site-header .brand .icon { width: 18px; height: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .navigation-dropdown .navigation-toggle { transition: none; }
}
@media (forced-colors: active) {
  .navigation-dropdown .navigation-toggle, :root .navigation-dropdown-panel { background: Canvas; color: CanvasText; border-color: CanvasText; }
  :root .navigation-dropdown-panel > a + a { border-top-color: CanvasText; }
  :root .navigation-dropdown-panel > a[aria-current="page"] { color: Highlight; }
}
